This is a fork of Zandronum used on servers hosted by The Sentinels Playground (TSPG), Euroboros (EB), and Down Under Doomers (DUD).
Revisão | 054a305d9f6b7772f60c9ba0a1507effd91af0e2 (tree) |
---|---|
Hora | 2023-07-12 01:37:31 |
Autor | Adam Kaminski <kaminskiadam9@gmai...> |
Commiter | Adam Kaminski |
Fixed: strings with "\c[X]x]" at the end were still being treated as a trailing color code.
@@ -709,19 +709,24 @@ | ||
709 | 709 | // [BB] Remove trailing color code of type "\c[X]". |
710 | 710 | else if ( pszString[ulStringLength-1] == ']' ) |
711 | 711 | { |
712 | - // [AK] "\c[X]]" is not a trailing color code. | |
713 | - if ( ( ulStringLength > 2 ) && ( pszString[ulStringLength-2] == ']' ) ) | |
714 | - break; | |
712 | + bool bHitClosingBracket = false; | |
713 | + int i = 0; | |
715 | 714 | |
716 | - int i = 0; | |
717 | 715 | for ( i = ulStringLength-2; i >= 2; --i ) |
718 | 716 | { |
717 | + // [AK] If we hit another ']' (e.g. "\c[X]]"), then it's not a trailing color code. | |
718 | + if ( pszString[i] == ']' ) | |
719 | + { | |
720 | + bHitClosingBracket = true; | |
721 | + break; | |
722 | + } | |
723 | + | |
719 | 724 | // [AK] We should keep checking for "\c[" until we reach the beginning of the string, |
720 | 725 | // in case the string contains something like "\c[X[[[]". |
721 | 726 | if ( ( pszString[i] == '[' ) && V_ColorCodeStart ( pszString, i-2 ) ) |
722 | 727 | break; |
723 | 728 | } |
724 | - if ( i >= 2 ) | |
729 | + if ( ( bHitClosingBracket == false ) && ( i >= 2 ) ) | |
725 | 730 | { |
726 | 731 | pszString[i-2] = 0; |
727 | 732 | ulStringLength = static_cast<ULONG>(strlen( pszString )); |