From: terencehill Date: Sat, 2 Mar 2013 22:14:05 +0000 (+0100) Subject: CA: Improve checks to determine whether an observer is in game or not X-Git-Tag: xonotic-v0.7.0~61^2~35 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=ed6c02954f4a72ae38017bbd422dc265c1cb3cc4;p=xonotic%2Fxonotic-data.pk3dir.git CA: Improve checks to determine whether an observer is in game or not --- diff --git a/qcsrc/server/bot/bot.qc b/qcsrc/server/bot/bot.qc index 45107b833..bc567ba24 100644 --- a/qcsrc/server/bot/bot.qc +++ b/qcsrc/server/bot/bot.qc @@ -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; } diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 8c922b2b2..c0ca7e8a0 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -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); diff --git a/qcsrc/server/command/cmd.qc b/qcsrc/server/command/cmd.qc index c357cf689..96f360602 100644 --- a/qcsrc/server/command/cmd.qc +++ b/qcsrc/server/command/cmd.qc @@ -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; diff --git a/qcsrc/server/command/vote.qc b/qcsrc/server/command/vote.qc index ad44e9382..b5e636b6f 100644 --- a/qcsrc/server/command/vote.qc +++ b/qcsrc/server/command/vote.qc @@ -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; diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 8ed48616e..dad5e33b3 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -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:"); diff --git a/qcsrc/server/scores.qc b/qcsrc/server/scores.qc index 2a0a58a51..7d9ffd8ca 100644 --- a/qcsrc/server/scores.qc +++ b/qcsrc/server/scores.qc @@ -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";