I hope I'm putting this in the correct place, The front page of ioquake3.org ( if you look for it ) says to post bugs here.
Anyways, in 'code/game/g_cmds.c' we have a function
/*
==================
SanitizeString
Remove case and control characters
==================
*/
void SanitizeString( char *in, char *out ) {
while ( *in ) {
if ( *in == 32 ) {
in += 2; // skip color code
continue;
}
if ( *in < 32 ) {
in++;
continue;
}
*out++ = tolower( *in++ );
}
*out = 0;
}
The problem is in the first if statement. decimal 32 is 'ESC'
so it should really be:
/*
==================
SanitizeString
Remove case and control characters
==================
*/
void SanitizeString( char *in, char *out ) {
while ( *in ) {
if ( *in == 94 ) { // '^'
in += 2; // skip color code
continue;
}
if ( *in < 32 ) {
in++;
continue;
}
*out++ = tolower( *in++ );
}
*out = 0;
}
This will properly strip color codes. I can provide in a patch upon request.
Woops, I made a typo, the original is actually
/*
==================
SanitizeString
Remove case and control characters
==================
*/
void SanitizeString( char *in, char *out ) {
while ( *in ) {
if ( *in == 27 ) {
in += 2; // skip color code
continue;
}
if ( *in < 32 ) {
in++;
continue;
}
*out++ = tolower( *in++ );
}
*out = 0;
}
and '27' decimal is ESC.
Nice catch. That function is only used by the 'follow' command. Shouldn't it use Q_CleanStr instead? Would you mind sending a patch that makes use of Q_CleanStr?
Created attachment 2053[details]
Patch
I think this is correct, all I did was made sure it compiled. One thing to note is that Q_CleanStr doesn't convert to lowercase where SanitizeString did.
that one didn't make the behavior consistent with other command like kick either. I've applied a modified version. Note that this is game code anyways so unless you develop a mod yourself you won't benefit from the changes.
Created attachment 2053 [details] Patch I think this is correct, all I did was made sure it compiled. One thing to note is that Q_CleanStr doesn't convert to lowercase where SanitizeString did.
Created attachment 2054 [details] Real patch I oops on the last one, this one is correct...