]> git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sv_main.c
sv_main: Remove redundant function
[xonotic/darkplaces.git] / sv_main.c
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