]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
sv_main: Remove redundant function
authorcloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 8 Oct 2020 12:54:26 +0000 (12:54 +0000)
committercloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 8 Oct 2020 12:54:26 +0000 (12:54 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@13005 d7cf8633-e32d-0410-b094-e92efae38249

server.h
sv_main.c

index 283f1660dcf82d4e6449a9b77136816814d9b994..9a9a6d9b4ffb9c4b80e4b5959d5878c00d623e0c 100644 (file)
--- 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);
index 463806d77bcee20fec8028051135f9dcfe34c24d..9f2a3f1f4c8e2ecf194b6c7be0caaa102498d4c7 100644 (file)
--- 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