From edcbb105656514e6b422d2d5e04f6dcb2e30459b Mon Sep 17 00:00:00 2001 From: Darkvater Date: Thu, 16 Nov 2006 17:41:24 +0000 Subject: (svn r7172) -Fix [r6931]: The console showed '?' characters instead of colours. Now strip all colours for the console. It's a bit magicky (magic numbers) but UTF8 fixes that soon. --- string.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'string.c') diff --git a/string.c b/string.c index 297e931fb..f6f10de13 100644 --- a/string.c +++ b/string.c @@ -72,6 +72,19 @@ void str_validate(char *str) if (!IsValidAsciiChar(*str, CS_ALPHANUMERAL)) *str = '?'; } +void str_strip_colours(char *str) +{ + char *dst = str; + for (; *str != '\0';) { + if (*str >= 15 && *str <= 31) { // magic colour codes + str++; + } else { + *dst++ = *str++; + } + } + *dst = '\0'; +} + /** * Only allow certain keys. You can define the filter to be used. This makes * sure no invalid keys can get into an editbox, like BELL. -- cgit v1.2.3-54-g00ecf