diff --git a/src/console.cpp b/src/console.cpp index 5c5ae2fb65..d3d908935a 100644 --- a/src/console.cpp +++ b/src/console.cpp @@ -107,7 +107,6 @@ void IConsolePrint(TextColour colour_code, const std::string &string) /* Create a copy of the string, strip if of colours and invalid * characters and (when applicable) assign it to the console buffer */ char *str = stredup(string.c_str()); - str_strip_colours(str); StrMakeValidInPlace(str); if (_network_dedicated) { diff --git a/src/string.cpp b/src/string.cpp index 14e5fee364..c4f8278843 100644 --- a/src/string.cpp +++ b/src/string.cpp @@ -423,29 +423,6 @@ bool StrEqualsIgnoreCase(const std::string_view str1, const std::string_view str return StrCompareIgnoreCase(str1, str2) == 0; } -/** Scans the string for colour codes and strips them */ -void str_strip_colours(char *str) -{ - char *dst = str; - WChar c; - size_t len; - - for (len = Utf8Decode(&c, str); c != '\0'; len = Utf8Decode(&c, str)) { - if (c < SCC_BLUE || c > SCC_BLACK) { - /* Copy the character back. Even if dst is current the same as str - * (i.e. no characters have been changed) this is quicker than - * moving the pointers ahead by len */ - do { - *dst++ = *str++; - } while (--len != 0); - } else { - /* Just skip (strip) the colour codes */ - str += len; - } - } - *dst = '\0'; -} - /** * Get the length of an UTF-8 encoded string in number of characters * and thus not the number of bytes that the encoded string contains. diff --git a/src/string_func.h b/src/string_func.h index 93f2b4e1de..35a150fb88 100644 --- a/src/string_func.h +++ b/src/string_func.h @@ -42,7 +42,6 @@ void StrMakeValidInPlace(char *str, const char *last, StringValidationSettings s void StrMakeValidInPlace(char *str, StringValidationSettings settings = SVS_REPLACE_WITH_QUESTION_MARK); void str_fix_scc_encoded(char *str, const char *last) NOACCESS(2); -void str_strip_colours(char *str); bool strtolower(std::string &str, std::string::size_type offs = 0); [[nodiscard]] bool StrValid(const char *str, const char *last) NOACCESS(2);