From 6b62f9c1b9da3c8e3edaea8dc2df9fb48b36cdc1 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Mon, 13 Mar 2023 05:19:32 +0300 Subject: [PATCH] engine: convert Cvar_Get with va to Cvar_Getf --- engine/common/host.c | 8 ++++---- engine/common/net_chan.c | 2 +- engine/common/net_ws.c | 4 ++-- engine/server/sv_main.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/engine/common/host.c b/engine/common/host.c index 54bee1c1..8e45bf82 100644 --- a/engine/common/host.c +++ b/engine/common/host.c @@ -1173,10 +1173,10 @@ int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGa con_gamemaps = Cvar_Get( "con_mapfilter", "1", FCVAR_ARCHIVE, "when true show only maps in game folder" ); Cvar_RegisterVariable( &sys_timescale ); - build = Cvar_Get( "buildnum", va( "%i", Q_buildnum_compat()), FCVAR_READ_ONLY, "returns a current build number" ); - ver = Cvar_Get( "ver", va( "%i/%s (hw build %i)", PROTOCOL_VERSION, XASH_COMPAT_VERSION, Q_buildnum_compat()), FCVAR_READ_ONLY, "shows an engine version" ); - Cvar_Get( "host_ver", va( "%i " XASH_VERSION " %s %s %s", Q_buildnum(), Q_buildos(), Q_buildarch(), Q_buildcommit() ), FCVAR_READ_ONLY, "detailed info about this build" ); - Cvar_Get( "host_lowmemorymode", va( "%i", XASH_LOW_MEMORY ), FCVAR_READ_ONLY, "indicates if engine compiled for low RAM consumption (0 - normal, 1 - low engine limits, 2 - low protocol limits)" ); + build = Cvar_Getf( "buildnum", FCVAR_READ_ONLY, "returns a current build number", "%i", Q_buildnum_compat()); + ver = Cvar_Getf( "ver", FCVAR_READ_ONLY, "shows an engine version", "%i/%s (hw build %i)", PROTOCOL_VERSION, XASH_COMPAT_VERSION, Q_buildnum_compat()); + Cvar_Getf( "host_ver", FCVAR_READ_ONLY, "detailed info about this build", "%i " XASH_VERSION " %s %s %s", Q_buildnum(), Q_buildos(), Q_buildarch(), Q_buildcommit()); + Cvar_Getf( "host_lowmemorymode", FCVAR_READ_ONLY, "indicates if engine compiled for low RAM consumption (0 - normal, 1 - low engine limits, 2 - low protocol limits)", "%i", XASH_LOW_MEMORY ); Mod_Init(); NET_Init(); diff --git a/engine/common/net_chan.c b/engine/common/net_chan.c index 934cf007..d75d226f 100644 --- a/engine/common/net_chan.c +++ b/engine/common/net_chan.c @@ -251,7 +251,7 @@ void Netchan_Init( void ) net_showpackets = Cvar_Get ("net_showpackets", "0", 0, "show network packets" ); net_chokeloopback = Cvar_Get( "net_chokeloop", "0", 0, "apply bandwidth choke to loopback packets" ); net_showdrop = Cvar_Get( "net_showdrop", "0", 0, "show packets that are dropped" ); - net_qport = Cvar_Get( "net_qport", va( "%i", port ), FCVAR_READ_ONLY, "current quake netport" ); + net_qport = Cvar_Getf( "net_qport", FCVAR_READ_ONLY, "current quake netport", "%i", port ); net_mempool = Mem_AllocPool( "Network Pool" ); diff --git a/engine/common/net_ws.c b/engine/common/net_ws.c index cb1ed789..5a93cd38 100644 --- a/engine/common/net_ws.c +++ b/engine/common/net_ws.c @@ -2166,9 +2166,9 @@ void NET_Init( void ) net_address = Cvar_Get( "net_address", "0", FCVAR_PRIVILEGED|FCVAR_READ_ONLY, "contain local address of current client" ); net_ipname = Cvar_Get( "ip", "localhost", FCVAR_PRIVILEGED, "network ip address" ); net_iphostport = Cvar_Get( "ip_hostport", "0", FCVAR_READ_ONLY, "network ip host port" ); - net_hostport = Cvar_Get( "hostport", va( "%i", PORT_SERVER ), FCVAR_READ_ONLY, "network default host port" ); + net_hostport = Cvar_Getf( "hostport", FCVAR_READ_ONLY, "network default host port", "%i", PORT_SERVER ); net_ipclientport = Cvar_Get( "ip_clientport", "0", FCVAR_READ_ONLY, "network ip client port" ); - net_clientport = Cvar_Get( "clientport", va( "%i", PORT_CLIENT ), FCVAR_READ_ONLY, "network default client port" ); + net_clientport = Cvar_Getf( "clientport", FCVAR_READ_ONLY, "network default client port", "%i", PORT_CLIENT ); net_fakelag = Cvar_Get( "fakelag", "0", FCVAR_PRIVILEGED, "lag all incoming network data (including loopback) by xxx ms." ); net_fakeloss = Cvar_Get( "fakeloss", "0", FCVAR_PRIVILEGED, "act like we dropped the packet this % of the time." ); diff --git a/engine/server/sv_main.c b/engine/server/sv_main.c index 43167322..b57a8993 100644 --- a/engine/server/sv_main.c +++ b/engine/server/sv_main.c @@ -874,7 +874,7 @@ void SV_Init( void ) SV_InitHostCommands(); - Cvar_Get( "protocol", va( "%i", PROTOCOL_VERSION ), FCVAR_READ_ONLY, "displays server protocol version" ); + Cvar_Getf( "protocol", FCVAR_READ_ONLY, "displays server protocol version", "%i", PROTOCOL_VERSION ); Cvar_Get( "suitvolume", "0.25", FCVAR_ARCHIVE, "HEV suit volume" ); Cvar_Get( "sv_background", "0", FCVAR_READ_ONLY, "indicate what background map is running" ); Cvar_Get( "gamedir", GI->gamefolder, FCVAR_READ_ONLY, "game folder" );