From bdd9b654e182e6c122c0107750a7a95f2f33351b Mon Sep 17 00:00:00 2001 From: cloudwalk Date: Thu, 8 Oct 2020 12:54:26 +0000 Subject: [PATCH] sv_main: Remove redundant function git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13005 d7cf8633-e32d-0410-b094-e92efae38249 --- server.h | 3 +-- sv_main.c | 20 ++++---------------- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/server.h b/server.h index 283f1660..9a9a6d9b 100644 --- a/server.h +++ b/server.h @@ -515,7 +515,7 @@ void SV_Init (void); double SV_Frame(double time); void SV_Shutdown(void); -int SV_IsLocalGame(void); +int SV_IsLocalServer(void); void SV_StartParticle (vec3_t org, vec3_t dir, int color, int count); void SV_StartEffect (vec3_t org, int modelindex, int startframe, int framecount, int framerate); @@ -605,7 +605,6 @@ void VM_SV_MoveToGoal(prvm_prog_t *prog); void SV_ApplyClientMove (void); void SV_SaveSpawnparms (void); -qbool SV_IsLocalServer(void); void SV_SpawnServer (const char *map); void SV_CheckVelocity (prvm_edict_t *ent); diff --git a/sv_main.c b/sv_main.c index 463806d7..9f2a3f1f 100644 --- a/sv_main.c +++ b/sv_main.c @@ -435,7 +435,7 @@ static void SV_AreaStats_f(cmd_state_t *cmd) static qbool SV_CanSave(void) { prvm_prog_t *prog = SVVM_prog; - if(SV_IsLocalGame() == 1) + if(SV_IsLocalServer() == 1) { // singleplayer checks if ((svs.clients[0].active && PRVM_serveredictfloat(svs.clients[0].edict, deadflag))) @@ -1694,11 +1694,10 @@ void SV_SaveSpawnparms (void) } } -qbool SV_IsLocalServer(void) +// Returns 1 if we're singleplayer, > 1 if we're a listen server +int SV_IsLocalServer(void) { - if(host_isclient.integer && host_client && LHNETADDRESS_GetAddressType(&host_client->netconnection->peeraddress) == LHNETADDRESSTYPE_LOOP) - return true; - return false; + return (host_isclient.integer && sv.active ? svs.maxclients : 0); } /* @@ -2014,17 +2013,6 @@ void SV_SpawnServer (const char *map) // SV_UnlockThreadMutex(); } -/* - * Returns number of slots if we're a listen server. - * Returns 0 if we're a dedicated server. - */ -int SV_IsLocalGame(void) -{ - if (sv.active && &svs.clients[0] && LHNETADDRESS_GetAddressType(&svs.clients[0].netconnection->peeraddress) == LHNETADDRESSTYPE_LOOP) - return svs.maxclients; - return 0; -} - /* ================== SV_Shutdown -- 2.39.2