Browse Source

engine: convert MSG_WriteString with va to MSG_WriteStringf

pull/2/head
Alibek Omarov 2 years ago
parent
commit
ba1cf25314
  1. 2
      engine/client/cl_custom.c
  2. 6
      engine/client/cl_parse.c
  3. 14
      engine/server/sv_client.c
  4. 2
      engine/server/sv_custom.c
  5. 2
      engine/server/sv_game.c
  6. 2
      engine/server/sv_save.c

2
engine/client/cl_custom.c

@ -78,7 +78,7 @@ qboolean CL_CheckFile( sizebuf_t *msg, resource_t *pResource )
} }
MSG_BeginClientCmd( msg, clc_stringcmd ); MSG_BeginClientCmd( msg, clc_stringcmd );
MSG_WriteString( msg, va( "dlfile %s", filepath )); MSG_WriteStringf( msg, "dlfile %s", filepath );
host.downloadcount++; host.downloadcount++;
return false; return false;

6
engine/client/cl_parse.c

@ -499,7 +499,7 @@ void CL_BatchResourceRequest( qboolean initialize )
if( !FBitSet( p->ucFlags, RES_REQUESTED )) if( !FBitSet( p->ucFlags, RES_REQUESTED ))
{ {
MSG_BeginClientCmd( &msg, clc_stringcmd ); MSG_BeginClientCmd( &msg, clc_stringcmd );
MSG_WriteString( &msg, va( "dlfile !MD5%s", MD5_Print( p->rgucMD5_hash ) ) ); MSG_WriteStringf( &msg, "dlfile !MD5%s", MD5_Print( p->rgucMD5_hash ));;
SetBits( p->ucFlags, RES_REQUESTED ); SetBits( p->ucFlags, RES_REQUESTED );
} }
break; break;
@ -1607,7 +1607,7 @@ void CL_RegisterResources( sizebuf_t *msg )
// done with all resources, issue prespawn command. // done with all resources, issue prespawn command.
// Include server count in case server disconnects and changes level during d/l // Include server count in case server disconnects and changes level during d/l
MSG_BeginClientCmd( msg, clc_stringcmd ); MSG_BeginClientCmd( msg, clc_stringcmd );
MSG_WriteString( msg, va( "spawn %i", cl.servercount )); MSG_WriteStringf( msg, "spawn %i", cl.servercount );
} }
} }
else else
@ -3078,7 +3078,7 @@ void CL_LegacyPrecache_f( void )
// done with all resources, issue prespawn command. // done with all resources, issue prespawn command.
// Include server count in case server disconnects and changes level during d/l // Include server count in case server disconnects and changes level during d/l
MSG_BeginClientCmd( &cls.netchan.message, clc_stringcmd ); MSG_BeginClientCmd( &cls.netchan.message, clc_stringcmd );
MSG_WriteString( &cls.netchan.message, va( "begin %i", spawncount )); MSG_WriteStringf( &cls.netchan.message, "begin %i", spawncount );
cls.signon = SIGNONS; cls.signon = SIGNONS;
} }

14
engine/server/sv_client.c

@ -1420,7 +1420,7 @@ void SV_PutClientInServer( sv_client_t *cl )
if( svgame.globals->cdAudioTrack ) if( svgame.globals->cdAudioTrack )
{ {
MSG_BeginServerCmd( &msg, svc_stufftext ); MSG_BeginServerCmd( &msg, svc_stufftext );
MSG_WriteString( &msg, va( "cd loop %3d\n", svgame.globals->cdAudioTrack )); MSG_WriteStringf( &msg, "cd loop %3d\n", svgame.globals->cdAudioTrack );
svgame.globals->cdAudioTrack = 0; svgame.globals->cdAudioTrack = 0;
} }
@ -1660,7 +1660,7 @@ static qboolean SV_New_f( sv_client_t *cl )
// server info string // server info string
MSG_BeginServerCmd( &msg, svc_stufftext ); MSG_BeginServerCmd( &msg, svc_stufftext );
MSG_WriteString( &msg, va( "fullserverinfo \"%s\"\n", SV_Serverinfo( ))); MSG_WriteStringf( &msg, "fullserverinfo \"%s\"\n", SV_Serverinfo( ));
// collect the info about all the players and send to me // collect the info about all the players and send to me
for( i = 0, cur = svs.clients; i < svs.maxclients; i++, cur++ ) for( i = 0, cur = svs.clients; i < svs.maxclients; i++, cur++ )
@ -2740,15 +2740,15 @@ static void SV_EntSendVars( sv_client_t *cl, edict_t *ent )
return; return;
MSG_WriteByte( &cl->netchan.message, svc_stufftext ); MSG_WriteByte( &cl->netchan.message, svc_stufftext );
MSG_WriteString( &cl->netchan.message, va( "set ent_last_name \"%s\"\n", STRING( ent->v.targetname ) )); MSG_WriteStringf( &cl->netchan.message, "set ent_last_name \"%s\"\n", STRING( ent->v.targetname ));
MSG_WriteByte( &cl->netchan.message, svc_stufftext ); MSG_WriteByte( &cl->netchan.message, svc_stufftext );
MSG_WriteString( &cl->netchan.message, va( "set ent_last_num %i\n", NUM_FOR_EDICT( ent ) )); MSG_WriteStringf( &cl->netchan.message, "set ent_last_num %i\n", NUM_FOR_EDICT( ent ));
MSG_WriteByte( &cl->netchan.message, svc_stufftext ); MSG_WriteByte( &cl->netchan.message, svc_stufftext );
MSG_WriteString( &cl->netchan.message, va( "set ent_last_inst !%i_%i\n", NUM_FOR_EDICT( ent ), ent->serialnumber )); MSG_WriteStringf( &cl->netchan.message, "set ent_last_inst !%i_%i\n", NUM_FOR_EDICT( ent ), ent->serialnumber );
MSG_WriteByte( &cl->netchan.message, svc_stufftext ); MSG_WriteByte( &cl->netchan.message, svc_stufftext );
MSG_WriteString( &cl->netchan.message, va( "set ent_last_origin \"%f %f %f\"\n", ent->v.origin[0], ent->v.origin[1], ent->v.origin[2])); MSG_WriteStringf( &cl->netchan.message, "set ent_last_origin \"%f %f %f\"\n", ent->v.origin[0], ent->v.origin[1], ent->v.origin[2] );
MSG_WriteByte( &cl->netchan.message, svc_stufftext ); MSG_WriteByte( &cl->netchan.message, svc_stufftext );
MSG_WriteString( &cl->netchan.message, va( "set ent_last_class \"%s\"\n", STRING( ent->v.classname ))); MSG_WriteStringf( &cl->netchan.message, "set ent_last_class \"%s\"\n", STRING( ent->v.classname ));
MSG_WriteByte( &cl->netchan.message, svc_stufftext ); MSG_WriteByte( &cl->netchan.message, svc_stufftext );
MSG_WriteString( &cl->netchan.message, "ent_getvars_cb\n" ); // why do we need this? MSG_WriteString( &cl->netchan.message, "ent_getvars_cb\n" ); // why do we need this?
} }

2
engine/server/sv_custom.c

@ -304,7 +304,7 @@ qboolean SV_CheckFile( sizebuf_t *msg, const char *filename )
return true; return true;
MSG_BeginServerCmd( msg, svc_stufftext ); MSG_BeginServerCmd( msg, svc_stufftext );
MSG_WriteString( msg, va( "upload \"!MD5%s\"\n", MD5_Print( p.rgucMD5_hash ))); MSG_WriteStringf( msg, "upload \"!MD5%s\"\n", MD5_Print( p.rgucMD5_hash ));
return false; return false;
} }

2
engine/server/sv_game.c

@ -2208,7 +2208,7 @@ SV_StartMusic
void SV_StartMusic( const char *curtrack, const char *looptrack, int position ) void SV_StartMusic( const char *curtrack, const char *looptrack, int position )
{ {
MSG_BeginServerCmd( &sv.multicast, svc_stufftext ); MSG_BeginServerCmd( &sv.multicast, svc_stufftext );
MSG_WriteString( &sv.multicast, va( "music \"%s\" \"%s\" %d\n", curtrack, looptrack, position )); MSG_WriteStringf( &sv.multicast, "music \"%s\" \"%s\" %d\n", curtrack, looptrack, position );
SV_Multicast( MSG_ALL, NULL, NULL, false, false ); SV_Multicast( MSG_ALL, NULL, NULL, false, false );
} }

2
engine/server/sv_save.c

@ -1389,7 +1389,7 @@ static void LoadClientState( SAVERESTOREDATA *pSaveData, const char *level, qboo
{ {
// NOTE: music is automatically goes across transition, never restore it on changelevel // NOTE: music is automatically goes across transition, never restore it on changelevel
MSG_BeginServerCmd( &sv.signon, svc_stufftext ); MSG_BeginServerCmd( &sv.signon, svc_stufftext );
MSG_WriteString( &sv.signon, va( "music \"%s\" \"%s\" %i\n", header.introTrack, header.mainTrack, header.trackPosition )); MSG_WriteStringf( &sv.signon, "music \"%s\" \"%s\" %i\n", header.introTrack, header.mainTrack, header.trackPosition );
} }
// don't go camera across the levels // don't go camera across the levels

Loading…
Cancel
Save