mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-28 21:57:57 +03:00
Add recursive check in Com_Printf
This prevents recursive call to Com_Printf during localization and also remove localization errors
This commit is contained in:
parent
a1e7afac76
commit
ca2322a4da
1 changed files with 10 additions and 2 deletions
|
@ -223,8 +223,13 @@ A raw string should NEVER be passed as fmt, because of "%f" type crashers.
|
||||||
void QDECL Com_Printf( const char *fmt, ... ) {
|
void QDECL Com_Printf( const char *fmt, ... ) {
|
||||||
va_list argptr;
|
va_list argptr;
|
||||||
char msg[MAXPRINTMSG];
|
char msg[MAXPRINTMSG];
|
||||||
static qboolean opening_qconsole = qfalse;
|
static qboolean opening_qconsole = qfalse;
|
||||||
|
static qboolean recursive_count = qfalse;
|
||||||
|
|
||||||
|
if (recursive_count) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
recursive_count = qtrue;
|
||||||
|
|
||||||
va_start (argptr,fmt);
|
va_start (argptr,fmt);
|
||||||
Q_vsnprintf (msg, sizeof(msg), fmt, argptr);
|
Q_vsnprintf (msg, sizeof(msg), fmt, argptr);
|
||||||
|
@ -239,6 +244,7 @@ void QDECL Com_Printf( const char *fmt, ... ) {
|
||||||
// TTimo nooo .. that would defeat the purpose
|
// TTimo nooo .. that would defeat the purpose
|
||||||
//rd_flush(rd_buffer);
|
//rd_flush(rd_buffer);
|
||||||
//*rd_buffer = 0;
|
//*rd_buffer = 0;
|
||||||
|
recursive_count--;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,7 +347,9 @@ void QDECL Com_Printf( const char *fmt, ... ) {
|
||||||
|
|
||||||
FS_Write(msg, msgLen, logfile);
|
FS_Write(msg, msgLen, logfile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
recursive_count--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue