mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-22 12:01:41 +00:00
Remove newlines from chat messages in Game VM
This has no affect due to ioquake3 engine already removing command separators (which includes newlines) in Cmd_Args_Sanitize().
This commit is contained in:
parent
f0b74a27c9
commit
3f267728c3
1 changed files with 18 additions and 0 deletions
|
@ -928,6 +928,16 @@ void G_Say( gentity_t *ent, gentity_t *target, int mode, const char *chatText )
|
|||
}
|
||||
}
|
||||
|
||||
static void SanitizeChatText( char *text ) {
|
||||
int i;
|
||||
|
||||
for ( i = 0; text[i]; i++ ) {
|
||||
if ( text[i] == '\n' || text[i] == '\r' ) {
|
||||
text[i] = ' ';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==================
|
||||
|
@ -950,6 +960,8 @@ static void Cmd_Say_f( gentity_t *ent, int mode, qboolean arg0 ) {
|
|||
p = ConcatArgs( 1 );
|
||||
}
|
||||
|
||||
SanitizeChatText( p );
|
||||
|
||||
G_Say( ent, NULL, mode, p );
|
||||
}
|
||||
|
||||
|
@ -982,6 +994,8 @@ static void Cmd_Tell_f( gentity_t *ent ) {
|
|||
|
||||
p = ConcatArgs( 2 );
|
||||
|
||||
SanitizeChatText( p );
|
||||
|
||||
G_LogPrintf( "tell: %s to %s: %s\n", ent->client->pers.netname, target->client->pers.netname, p );
|
||||
G_Say( ent, target, SAY_TELL, p );
|
||||
// don't tell to the player self if it was already directed to this player
|
||||
|
@ -1076,6 +1090,8 @@ static void Cmd_Voice_f( gentity_t *ent, int mode, qboolean arg0, qboolean voice
|
|||
p = ConcatArgs( 1 );
|
||||
}
|
||||
|
||||
SanitizeChatText( p );
|
||||
|
||||
G_Voice( ent, NULL, mode, p, voiceonly );
|
||||
}
|
||||
|
||||
|
@ -1108,6 +1124,8 @@ static void Cmd_VoiceTell_f( gentity_t *ent, qboolean voiceonly ) {
|
|||
|
||||
id = ConcatArgs( 2 );
|
||||
|
||||
SanitizeChatText( id );
|
||||
|
||||
G_LogPrintf( "vtell: %s to %s: %s\n", ent->client->pers.netname, target->client->pers.netname, id );
|
||||
G_Voice( ent, target, SAY_TELL, id, voiceonly );
|
||||
// don't tell to the player self if it was already directed to this player
|
||||
|
|
Loading…
Reference in a new issue