From b58e16b7566559517bffb7be059c188e4b088927 Mon Sep 17 00:00:00 2001 From: Anton Tarasenko Date: Fri, 17 Jun 2022 20:26:56 +0700 Subject: [PATCH] Change `FutilityChat` to use new text functions --- .../FutileChat/FutilityChat_Feature.uc | 31 ++++++------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/sources/Features/FutileChat/FutilityChat_Feature.uc b/sources/Features/FutileChat/FutilityChat_Feature.uc index 738feb2..08ea3b5 100644 --- a/sources/Features/FutileChat/FutilityChat_Feature.uc +++ b/sources/Features/FutileChat/FutilityChat_Feature.uc @@ -93,9 +93,7 @@ private function bool ReformatChatMessage( MutableText message, bool teamMessage) { - local int i; - local MutableText messageCopy; - local Text.Character nextCharacter; + local Text messageCopy; local Text.Formatting defaultFormatting; if (sender == none) return true; if (message == none) return true; @@ -111,28 +109,17 @@ private function bool ReformatChatMessage( defaultFormatting.color = configuredColor; } if (message.StartsWith(P("|"))) { - messageCopy = message.MutableCopy(1); + message.Remove(0, 1); } - else if ( colorSetting == CCS_TeamColorForced - || colorSetting == CCS_ConfigColorForced) + else if ( colorSetting != CCS_TeamColorForced + && colorSetting != CCS_ConfigColorForced) { - messageCopy = message.MutableCopy(); + messageCopy = message.Copy(); + class'FormattingStringParser'.static + .ParseFormatted(messageCopy, message.Clear()); + _.memory.Free(messageCopy); } - else - { - 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); + message.ChangeDefaultFormatting(defaultFormatting); return true; }