]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
New way to check if server is local or dedicated in code
authorSamual Lenks <samual@xonotic.org>
Tue, 26 Feb 2013 16:26:47 +0000 (11:26 -0500)
committerSamual Lenks <samual@xonotic.org>
Tue, 26 Feb 2013 16:26:47 +0000 (11:26 -0500)
qcsrc/server/cl_client.qc
qcsrc/server/defs.qh
qcsrc/server/g_world.qc

index 07a6942ae6e537cc0cbc7084fc0d7f7d1069fcec..277f0dd1638bd8a6855a17d73a6af9aa72c4144c 100644 (file)
@@ -1375,16 +1375,6 @@ void ClientConnect (void)
        self.flags = FL_CLIENT;
        self.version_nagtime = time + 10 + random() * 10;
 
-       if(self.netaddress == "local")
-       {
-               //print("^3server is local!\n");
-
-               if(server_is_local)
-                       error("Multiple local clients???");
-               else
-                       server_is_local = TRUE;
-       }
-
        if(player_count<0)
        {
                dprint("BUG player count is lower than zero, this cannot happen!\n");
index 71fda2ea983ae47d4138f2b6e3e25b28a81fd082..25f00a73997ab5091e428457a66e2902fa8dde38 100644 (file)
@@ -57,7 +57,9 @@ float team1_score, team2_score, team3_score, team4_score;
 
 float maxclients;
 
-float server_is_local; // innocent until proven guilty by ClientConnect() in cl_client.qc
+// flags set on worldspawn so that the code knows if it is dedicated or not
+float server_is_dedicated; 
+float server_is_local; 
 
 // Fields
 
index 4589639cd721ad157b7ee73368dac512d783f58f..8ff2ac8a572a001390799dcffed8ae6ee32adb72 100644 (file)
@@ -555,6 +555,8 @@ void spawnfunc___init_dedicated_server(void)
 
        MapInfo_Enumerate();
        MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags(), 0);
+
+       print("^1YO SAMUAL, CHECK THIS SHIT OUT MOTHERFUCKER! _init spawnfunc was called!\n");
 }
 
 void Map_MarkAsRecent(string m);
@@ -595,6 +597,17 @@ void spawnfunc_worldspawn (void)
                head = nextent(head);
        }
 
+       if(cvar_defstring("is_dedicated"))
+       {
+               server_is_dedicated = TRUE;
+               server_is_local = FALSE;
+       }
+       else
+       {
+               server_is_dedicated = FALSE;
+               server_is_local = TRUE;
+       }
+
        // needs to be done so early because of the constants they create
        CALL_ACCUMULATED_FUNCTION(RegisterWeapons);
        CALL_ACCUMULATED_FUNCTION(RegisterGametypes);