From d0a33a0b02e634b921c68f59195d5902d28ee2e1 Mon Sep 17 00:00:00 2001 From: terencehill Date: Sun, 16 May 2010 18:28:57 +0200 Subject: [PATCH] Fixed a bug in CA with bot_vs_human active When u loose, bots immediately disconnect and don't get the point for the round. --- qcsrc/server/arena.qc | 13 ++++++++----- qcsrc/server/bot/bot.qc | 2 +- qcsrc/server/cl_player.qc | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/qcsrc/server/arena.qc b/qcsrc/server/arena.qc index 5dd01d4dd..e68e29502 100644 --- a/qcsrc/server/arena.qc +++ b/qcsrc/server/arena.qc @@ -11,6 +11,7 @@ entity champion; float warmup; float allowed_to_spawn; float player_cnt; +float required_ca_players; .float caplayer; void PutObserverInServer(); @@ -43,7 +44,7 @@ void reset_map(float dorespawn) lms_next_place = player_count; race_ReadyRestart(); - + for(self = world; (self = nextent(self)); ) if(clienttype(self) == CLIENTTYPE_NOTACLIENT) { @@ -198,7 +199,7 @@ void Arena_Warmup() allowed_to_spawn = 0; - if(g_ca && (player_cnt < 2 || inWarmupStage)) + if(g_ca && (player_cnt < required_ca_players || inWarmupStage)) allowed_to_spawn = 1; msg = NEWLINES; @@ -280,13 +281,15 @@ void Spawnqueue_Check() } } - if(player_cnt < 2 && (redspawned && bluespawned)) { + required_ca_players = max(2, fabs(cvar("bot_vs_human") + 1)); + + if(player_cnt < required_ca_players && (redspawned && bluespawned)) { reset_map(TRUE); } - else if(player_cnt < 2) { + else if(player_cnt < required_ca_players) { FOR_EACH_CLIENT(self) if(self.classname == "player") - centerprint(self, strcat("^1Need at least 2 players to play CA", "^7\n")); + centerprint(self, strcat("^1Need at least 1 player in each team to play CA", "^7\n")); allowed_to_spawn = 1; return; diff --git a/qcsrc/server/bot/bot.qc b/qcsrc/server/bot/bot.qc index b42853045..58dc1cf86 100644 --- a/qcsrc/server/bot/bot.qc +++ b/qcsrc/server/bot/bot.qc @@ -527,7 +527,7 @@ void bot_serverframe() FOR_EACH_REALCLIENT(head) { - if(head.classname == "player" || g_lms || g_arena) + if(head.classname == "player" || g_lms || g_arena || g_ca) ++activerealplayers; ++realplayers; } diff --git a/qcsrc/server/cl_player.qc b/qcsrc/server/cl_player.qc index 7e73ea345..3a3a8a0d7 100644 --- a/qcsrc/server/cl_player.qc +++ b/qcsrc/server/cl_player.qc @@ -432,7 +432,7 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht else Violence_GibSplash_At(hitloc, force, 2, bound(0, damage, 200) / 16, self, attacker); - if((g_arena && numspawned < 2) || (g_ca && player_cnt < 2) && !inWarmupStage) + if((g_arena && numspawned < 2) || (g_ca && player_cnt < required_ca_players) && !inWarmupStage) return; if (!g_minstagib) -- 2.39.2