engine: convert Info_SetValueForKey with va to Info_SetValueForKeyf

This commit is contained in:
Alibek Omarov 2023-03-13 05:37:45 +03:00
parent d667845777
commit 5ef97ae99e
4 changed files with 15 additions and 15 deletions

View File

@ -1029,9 +1029,9 @@ void CL_SendConnectPacket( void )
Cvar_SetCheatState();
Cvar_FullSet( "sv_cheats", "0", FCVAR_READ_ONLY | FCVAR_SERVER );
Info_SetValueForKey( protinfo, "d", va( "%d", input_devices ), sizeof( protinfo ) );
Info_SetValueForKeyf( protinfo, "d", sizeof( protinfo ), "%d", input_devices );
Info_SetValueForKey( protinfo, "v", XASH_VERSION, sizeof( protinfo ) );
Info_SetValueForKey( protinfo, "b", va( "%d", Q_buildnum() ), sizeof( protinfo ) );
Info_SetValueForKeyf( protinfo, "b", sizeof( protinfo ), "%d", Q_buildnum( ));
Info_SetValueForKey( protinfo, "o", Q_buildos(), sizeof( protinfo ) );
Info_SetValueForKey( protinfo, "a", Q_buildarch(), sizeof( protinfo ) );
}
@ -1065,7 +1065,7 @@ void CL_SendConnectPacket( void )
Info_SetValueForKey( protinfo, "uuid", key, sizeof( protinfo ));
Info_SetValueForKey( protinfo, "qport", qport, sizeof( protinfo ));
Info_SetValueForKey( protinfo, "ext", va("%d", extensions), sizeof( protinfo ));
Info_SetValueForKeyf( protinfo, "ext", sizeof( protinfo ), "%d", extensions);
Netchan_OutOfBandPrint( NS_CLIENT, adr, "connect %i %i \"%s\" \"%s\"\n", PROTOCOL_VERSION, cls.challenge, protinfo, cls.userinfo );
Con_Printf( "Trying to connect by modern protocol\n" );

View File

@ -432,7 +432,7 @@ void SV_ConnectClient( netadr_t from )
// build protinfo answer
protinfo[0] = '\0';
Info_SetValueForKey( protinfo, "ext", va( "%d", newcl->extensions ), sizeof( protinfo ) );
Info_SetValueForKeyf( protinfo, "ext", sizeof( protinfo ), "%d", newcl->extensions );
// send the connect packet to the client
Netchan_OutOfBandPrint( NS_SERVER, from, "client_connect %s", protinfo );
@ -875,13 +875,13 @@ void SV_Info( netadr_t from, int protocolVersion )
SV_GetPlayerCount( &count, &bots );
// a1ba: send protocol version to distinguish old engine and new
Info_SetValueForKey( s, "p", va( "%i", PROTOCOL_VERSION ), sizeof( s ));
Info_SetValueForKeyf( s, "p", sizeof( s ), "%i", PROTOCOL_VERSION );
Info_SetValueForKey( s, "map", sv.name, sizeof( s ));
Info_SetValueForKey( s, "dm", svgame.globals->deathmatch ? "1" : "0", sizeof( s ));
Info_SetValueForKey( s, "team", svgame.globals->teamplay ? "1" : "0", sizeof( s ));
Info_SetValueForKey( s, "coop", svgame.globals->coop ? "1" : "0", sizeof( s ));
Info_SetValueForKey( s, "numcl", va( "%i", count ), sizeof( s ));
Info_SetValueForKey( s, "maxcl", va( "%i", svs.maxclients ), sizeof( s ));
Info_SetValueForKeyf( s, "numcl", sizeof( s ), "%i", count );
Info_SetValueForKeyf( s, "maxcl", sizeof( s ), "%i", svs.maxclients );
Info_SetValueForKey( s, "gamedir", GI->gamefolder, sizeof( s ));
Info_SetValueForKey( s, "password", have_password ? "1" : "0", sizeof( s ));
@ -980,8 +980,8 @@ void SV_BuildNetAnswer( netadr_t from )
string[0] = '\0';
Info_SetValueForKey( string, "hostname", hostname.string, MAX_INFO_STRING );
Info_SetValueForKey( string, "gamedir", GI->gamefolder, MAX_INFO_STRING );
Info_SetValueForKey( string, "current", va( "%i", count ), MAX_INFO_STRING );
Info_SetValueForKey( string, "max", va( "%i", svs.maxclients ), MAX_INFO_STRING );
Info_SetValueForKeyf( string, "current", MAX_INFO_STRING, "%i", count );
Info_SetValueForKeyf( string, "max", MAX_INFO_STRING, "%i", svs.maxclients );
Info_SetValueForKey( string, "map", sv.name, MAX_INFO_STRING );
// send serverinfo

View File

@ -3765,7 +3765,7 @@ void GAME_EXPORT pfnSetClientMaxspeed( const edict_t *pEdict, float fNewMaxspeed
return;
fNewMaxspeed = bound( -svgame.movevars.maxspeed, fNewMaxspeed, svgame.movevars.maxspeed );
Info_SetValueForKey( cl->physinfo, "maxspd", va( "%.f", fNewMaxspeed ), MAX_INFO_STRING );
Info_SetValueForKeyf( cl->physinfo, "maxspd", MAX_INFO_STRING, "%.f", fNewMaxspeed );
cl->edict->v.maxspeed = fNewMaxspeed;
}

View File

@ -781,11 +781,11 @@ void SV_AddToMaster( netadr_t from, sizebuf_t *msg )
}
SV_GetPlayerCount( &clients, &bots );
Info_SetValueForKey( s, "protocol", va( "%d", PROTOCOL_VERSION ), len ); // protocol version
Info_SetValueForKey( s, "challenge", va( "%u", challenge ), len ); // challenge number
Info_SetValueForKey( s, "players", va( "%d", clients ), len ); // current player number, without bots
Info_SetValueForKey( s, "max", va( "%d", svs.maxclients ), len ); // max_players
Info_SetValueForKey( s, "bots", va( "%d", bots ), len ); // bot count
Info_SetValueForKeyf( s, "protocol", len, "%d", PROTOCOL_VERSION ); // protocol version
Info_SetValueForKeyf( s, "challenge", len, "%u", challenge ); // challenge number
Info_SetValueForKeyf( s, "players", len, "%d", clients ); // current player number, without bots
Info_SetValueForKeyf( s, "max", len, "%d", svs.maxclients ); // max_players
Info_SetValueForKeyf( s, "bots", len, "%d", bots ); // bot count
Info_SetValueForKey( s, "gamedir", GI->gamefolder, len ); // gamedir
Info_SetValueForKey( s, "map", sv.name, len ); // current map
Info_SetValueForKey( s, "type", (Host_IsDedicated()) ? "d" : "l", len ); // dedicated or local