1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-25 23:49:09 +00:00

(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.
This commit is contained in:
Darkvater
2006-11-16 17:41:24 +00:00
parent 81b84c9091
commit edcbb10565
3 changed files with 17 additions and 0 deletions

View File

@@ -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.