From c5471fe6fd9a6258e161b9094ffd20682238bc58 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sun, 17 Nov 2024 13:36:40 +0300 Subject: [PATCH] engine: server: make SV_IsPlayerIndex and SV_HavePassword inline --- engine/server/server.h | 15 +++++++++++++-- engine/server/sv_client.c | 27 --------------------------- 2 files changed, 13 insertions(+), 29 deletions(-) diff --git a/engine/server/server.h b/engine/server/server.h index 8a5c432a..e369e389 100644 --- a/engine/server/server.h +++ b/engine/server/server.h @@ -542,13 +542,24 @@ void SV_ExecuteClientMessage( sv_client_t *cl, sizebuf_t *msg ); void SV_ConnectionlessPacket( netadr_t from, sizebuf_t *msg ); edict_t *SV_FakeConnect( const char *netname ); void SV_BuildReconnect( sizebuf_t *msg ); -qboolean SV_IsPlayerIndex( int idx ); int SV_CalcPing( sv_client_t *cl ); void SV_UpdateServerInfo( void ); void SV_EndRedirect( host_redirect_t *rd ); void SV_RejectConnection( netadr_t from, const char *fmt, ... ) FORMAT_CHECK( 2 ); void SV_GetPlayerCount( int *clients, int *bots ); -qboolean SV_HavePassword( void ); + +static inline qboolean SV_HavePassword( void ) +{ + if( COM_CheckStringEmpty( sv_password.string ) && Q_stricmp( sv_password.string, "none" )) + return true; + + return false; +} + +static inline qboolean SV_IsPlayerIndex( int idx ) +{ + return idx > 0 && idx <= svs.maxclients ? true : false; +} // // sv_cmds.c diff --git a/engine/server/sv_client.c b/engine/server/sv_client.c index 4516c224..bed4524e 100644 --- a/engine/server/sv_client.c +++ b/engine/server/sv_client.c @@ -46,20 +46,6 @@ static int g_userid = 1; static void SV_UserinfoChanged( sv_client_t *cl ); static void SV_ExecuteClientCommand( sv_client_t *cl, const char *s ); -/* -================= -SV_HavePassword - -================= -*/ -qboolean SV_HavePassword( void ) -{ - if( COM_CheckStringEmpty( sv_password.string ) && Q_stricmp( sv_password.string, "none" )) - return true; - - return false; -} - /* ================= SV_GetPlayerCount @@ -1373,19 +1359,6 @@ qboolean SV_ShouldUpdatePing( sv_client_t *cl ) return FBitSet( cl->lastcmd.buttons, IN_SCORE ) ? true : false; } -/* -=================== -SV_IsPlayerIndex - -=================== -*/ -qboolean SV_IsPlayerIndex( int idx ) -{ - if( idx > 0 && idx <= svs.maxclients ) - return true; - return false; -} - /* =================== SV_GetPlayerStats