[iortcw] 87/89: All: Remove newlines from chat messages in Game VM
Simon McVittie
smcv at debian.org
Fri Sep 8 10:44:35 UTC 2017
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to tag 1.51b
in repository iortcw.
commit 7456532e8b20f215e49c23a48e7c34eb3a4bab1b
Author: MAN-AT-ARMS <M4N4T4RMS at gmail.com>
Date: Sat Aug 12 16:25:34 2017 -0400
All: Remove newlines from chat messages in Game VM
---
MP/code/game/g_cmds.c | 17 +++++++++++++++++
SP/code/game/g_cmds.c | 13 +++++++++++++
2 files changed, 30 insertions(+)
diff --git a/MP/code/game/g_cmds.c b/MP/code/game/g_cmds.c
index c856676..5609f31 100644
--- a/MP/code/game/g_cmds.c
+++ b/MP/code/game/g_cmds.c
@@ -1066,6 +1066,15 @@ 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] = ' ';
+ }
+ }
+}
/*
==================
@@ -1086,6 +1095,8 @@ static void Cmd_Say_f( gentity_t *ent, int mode, qboolean arg0 ) {
p = ConcatArgs( 1 );
}
+ SanitizeChatText( p );
+
G_Say( ent, NULL, mode, p );
}
@@ -1118,6 +1129,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
@@ -1228,6 +1241,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 );
}
@@ -1261,6 +1276,8 @@ static void Cmd_VoiceTell_f( gentity_t *ent, qboolean voiceonly ) {
id = ConcatArgs( 2 );
+ SanitizeChatText( p );
+
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
diff --git a/SP/code/game/g_cmds.c b/SP/code/game/g_cmds.c
index e60ddf6..a289790 100644
--- a/SP/code/game/g_cmds.c
+++ b/SP/code/game/g_cmds.c
@@ -1023,6 +1023,15 @@ 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] = ' ';
+ }
+ }
+}
/*
==================
@@ -1043,6 +1052,8 @@ static void Cmd_Say_f( gentity_t *ent, int mode, qboolean arg0 ) {
p = ConcatArgs( 1 );
}
+ SanitizeChatText( p );
+
G_Say( ent, NULL, mode, p );
}
@@ -1075,6 +1086,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 );
G_Say( ent, ent, SAY_TELL, p );
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git
More information about the Pkg-games-commits
mailing list