diff options
author | Andrey Nazarov <skuller@skuller.net> | 2007-10-07 21:08:14 +0000 |
---|---|---|
committer | Andrey Nazarov <skuller@skuller.net> | 2007-10-07 21:08:14 +0000 |
commit | d95d025a1bbfcdd43f1d13e1aedceed53c28d7cf (patch) | |
tree | d6a9241af6ab21337ed8d782d508efe539772c01 /source/sv_game.c | |
parent | e2a278c4a223328ac8c90d8c2b8b7c86cf095fa1 (diff) |
Use MSG_WriteData instead of MSG_WriteString when possible.
Dropped check for \xff byte inside MSG_WriteString,
clients nowadays should not use 3.20 anyway.
Diffstat (limited to 'source/sv_game.c')
-rw-r--r-- | source/sv_game.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/source/sv_game.c b/source/sv_game.c index 8565846..e7a6896 100644 --- a/source/sv_game.c +++ b/source/sv_game.c @@ -147,15 +147,16 @@ static void PF_bprintf( int level, const char *fmt, ... ) { va_list argptr; char string[MAX_STRING_CHARS]; client_t *client; + int length; int i; va_start( argptr, fmt ); - Q_vsnprintf( string, sizeof( string ), fmt, argptr ); + length = Q_vsnprintf( string, sizeof( string ), fmt, argptr ); va_end( argptr ); MSG_WriteByte( svc_print ); MSG_WriteByte( level ); - MSG_WriteString( string ); + MSG_WriteData( string, length + 1 ); // echo to console if( dedicated->integer ) { @@ -210,11 +211,11 @@ Archived in MVD stream. static void PF_cprintf( edict_t *ent, int level, const char *fmt, ... ) { char msg[MAX_STRING_CHARS]; va_list argptr; - int clientNum; + int clientNum, length; client_t *client; va_start( argptr, fmt ); - Q_vsnprintf( msg, sizeof( msg ), fmt, argptr ); + length = Q_vsnprintf( msg, sizeof( msg ), fmt, argptr ); va_end( argptr ); if( !ent ) { @@ -234,7 +235,7 @@ static void PF_cprintf( edict_t *ent, int level, const char *fmt, ... ) { MSG_WriteByte( svc_print ); MSG_WriteByte( level ); - MSG_WriteString( msg ); + MSG_WriteData( msg, length + 1 ); if( level >= client->messagelevel ) { SV_ClientAddMessage( client, MSG_RELIABLE ); @@ -261,7 +262,7 @@ Archived in MVD stream. static void PF_centerprintf (edict_t *ent, const char *fmt, ...) { char msg[MAX_STRING_CHARS]; va_list argptr; - int n; + int n, length; if( !ent ) { return; @@ -274,11 +275,11 @@ static void PF_centerprintf (edict_t *ent, const char *fmt, ...) { } va_start (argptr,fmt); - Q_vsnprintf( msg, sizeof( msg ), fmt, argptr ); + length = Q_vsnprintf( msg, sizeof( msg ), fmt, argptr ); va_end (argptr); MSG_WriteByte (svc_centerprint); - MSG_WriteString (msg); + MSG_WriteData (msg, length + 1); PF_Unicast (ent, qtrue); } @@ -374,7 +375,7 @@ void PF_Configstring( int index, const char *val ) { // send the update to everyone MSG_WriteByte( svc_configstring ); MSG_WriteShort( index ); - MSG_WriteString( val ); + MSG_WriteData( val, length + 1 ); FOR_EACH_CLIENT( client ) { if( client->state < cs_primed ) { |