Browse Source

Change `FutilityChat` to use new text functions

feature_improvement
Anton Tarasenko 2 years ago
parent
commit
b58e16b756
  1. 31
      sources/Features/FutileChat/FutilityChat_Feature.uc

31
sources/Features/FutileChat/FutilityChat_Feature.uc

@ -93,9 +93,7 @@ private function bool ReformatChatMessage(
MutableText message, MutableText message,
bool teamMessage) bool teamMessage)
{ {
local int i; local Text messageCopy;
local MutableText messageCopy;
local Text.Character nextCharacter;
local Text.Formatting defaultFormatting; local Text.Formatting defaultFormatting;
if (sender == none) return true; if (sender == none) return true;
if (message == none) return true; if (message == none) return true;
@ -111,28 +109,17 @@ private function bool ReformatChatMessage(
defaultFormatting.color = configuredColor; defaultFormatting.color = configuredColor;
} }
if (message.StartsWith(P("|"))) { if (message.StartsWith(P("|"))) {
messageCopy = message.MutableCopy(1); message.Remove(0, 1);
} }
else if ( colorSetting == CCS_TeamColorForced else if ( colorSetting != CCS_TeamColorForced
|| colorSetting == CCS_ConfigColorForced) && colorSetting != CCS_ConfigColorForced)
{ {
messageCopy = message.MutableCopy(); messageCopy = message.Copy();
class'FormattingStringParser'.static
.ParseFormatted(messageCopy, message.Clear());
_.memory.Free(messageCopy);
} }
else message.ChangeDefaultFormatting(defaultFormatting);
{
messageCopy = _.text.Empty();
messageCopy.AppendFormatted(message);
}
message.Clear();
for (i = 0; i < messageCopy.GetLength(); i += 1)
{
nextCharacter = messageCopy.GetCharacter(i);
if (!nextCharacter.formatting.isColored) {
nextCharacter.formatting = defaultFormatting;
}
message.AppendCharacter(nextCharacter);
}
_.memory.Free(messageCopy);
return true; return true;
} }

Loading…
Cancel
Save