]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
CA: Improve checks to determine whether an observer is in game or not
authorterencehill <piuntn@gmail.com>
Sat, 2 Mar 2013 22:14:05 +0000 (23:14 +0100)
committerterencehill <piuntn@gmail.com>
Sat, 2 Mar 2013 22:14:05 +0000 (23:14 +0100)
qcsrc/server/bot/bot.qc
qcsrc/server/cl_client.qc
qcsrc/server/command/cmd.qc
qcsrc/server/command/vote.qc
qcsrc/server/g_world.qc
qcsrc/server/scores.qc

index 45107b833a1b16221b8082da7c55c143d7b9244b..bc567ba246cf3147615c1e98d1d33874de0f31f1 100644 (file)
@@ -551,7 +551,7 @@ float bot_fixcount()
 
        FOR_EACH_REALCLIENT(head)
        {
-               if(head.classname == "player" || g_lms || g_arena || g_ca)
+               if(head.classname == "player" || g_lms || g_arena || head.caplayer == 1)
                        ++activerealplayers;
                ++realplayers;
        }
index 8c922b2b288bc63849b3f85f637b3460569aacbb..c0ca7e8a0be09e31ae0429606b69fcb6c0359927 100644 (file)
@@ -2284,9 +2284,7 @@ void LeaveSpectatorMode()
 
                        return;
                } else {
-                       if (g_ca && self.caplayer) {
-                       }       // do nothing
-                       else
+                       if(!self.caplayer)
                                stuffcmd(self,"menu_showteamselect\n");
                        return;
                }
@@ -2332,8 +2330,9 @@ float nJoinAllowed(entity ignore) {
                return maxclients - totalClients;
 
        float currentlyPlaying = 0;
-       FOR_EACH_REALPLAYER(e)
-               currentlyPlaying += 1;
+       FOR_EACH_REALCLIENT(e)
+               if(e.classname == "player" || e.caplayer == 1)
+                       currentlyPlaying += 1;
 
        if(currentlyPlaying < autocvar_g_maxplayers)
                return min(maxclients - totalClients, autocvar_g_maxplayers - currentlyPlaying);
index c357cf689ccd093d762b6cc7d24658550a2eb4f7..96f3606021e7e00b9de86939e230f07a5d016f1e 100644 (file)
@@ -411,10 +411,10 @@ void ClientCommand_spectate(float request)
                                
                                if(self.classname == "player" && autocvar_sv_spectate == 1) 
                                        ClientKill_TeamChange(-2); // observe
-                               
+
                                // in CA, allow a dead player to move to spectators (without that, caplayer!=0 will be moved back to the player list)
                                // note: if arena game mode is ever done properly, this needs to be removed.
-                               if(g_ca && self.caplayer && (self.classname == "spectator" || self.classname == "observer"))
+                               if(self.caplayer && (self.classname == "spectator" || self.classname == "observer"))
                                {
                                        sprint(self, "WARNING: you will spectate in the next round.\n");
                                        self.caplayer = 0;
index ad44e9382455d9303626f269112d38006bd52443..b5e636b6f39c84a4e9ca6346e99c047e832297b0 100644 (file)
@@ -439,7 +439,7 @@ void ReadyRestart_force()
        inWarmupStage = 0; // once the game is restarted the game is in match stage
 
        // reset the .ready status of all players (also spectators)
-       FOR_EACH_CLIENTSLOT(tmp_player) { tmp_player.ready = 0; }
+       FOR_EACH_REALCLIENT(tmp_player) { tmp_player.ready = 0; }
        readycount = 0;
        Nagger_ReadyCounted(); // NOTE: this causes a resend of that entity, and will also turn off warmup state on the client
 
@@ -491,10 +491,13 @@ void ReadyCount()
        float ready_needed_factor, ready_needed_count;
        float t_ready = 0, t_players = 0;
 
-       FOR_EACH_REALPLAYER(tmp_player)
+       FOR_EACH_REALCLIENT(tmp_player)
        {
-               ++t_players;
-               if(tmp_player.ready) { ++t_ready; }
+               if(tmp_player.classname == "player" || tmp_player.caplayer == 1)
+               {
+                       ++t_players;
+                       if(tmp_player.ready) { ++t_ready; }
+               }
        }
 
        readycount = t_ready;
index 8ed48616e14ac3dd50e7c6209f8d3153dd92e013..dad5e33b3fdc92c925bab6c648470bce55244c67 100644 (file)
@@ -1464,7 +1464,7 @@ void DumpStats(float final)
                {
                        s = strcat(":player:see-labels:", GetPlayerScoreString(other, 0), ":");
                        s = strcat(s, ftos(rint(time - other.jointime)), ":");
-                       if(other.classname == "player" || g_arena || g_ca || g_lms)
+                       if(other.classname == "player" || g_arena || other.caplayer == 1 || g_lms)
                                s = strcat(s, ftos(other.team), ":");
                        else
                                s = strcat(s, "spectator:");
index 2a0a58a51d6a092a02e48a2c7f5a2618f508d664..7d9ffd8ca3c3ae6b7488ed0d08da958ff676365c 100644 (file)
@@ -527,12 +527,12 @@ void WinningConditionHelper()
                                s = strcat(s, ":human");
                        else
                                s = strcat(s, ":bot");
-                       if(p.classname != "player" && !g_arena && !g_ca && !g_lms)
+                       if(p.classname != "player" && !g_arena && p.caplayer != 1 && !g_lms)
                                s = strcat(s, ":spectator");
                }
                else
                {
-                       if(p.classname == "player" || g_arena || g_ca || g_lms)
+                       if(p.classname == "player" || g_arena || p.caplayer == 1 || g_lms)
                                s = GetPlayerScoreString(p, 2);
                        else
                                s = "-666";