]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fixed a bug in CA with bot_vs_human active
authorterencehill <piuntn@gmail.com>
Sun, 16 May 2010 16:28:57 +0000 (18:28 +0200)
committerterencehill <piuntn@gmail.com>
Sun, 16 May 2010 16:28:57 +0000 (18:28 +0200)
When u loose, bots immediately disconnect and don't get the point for the round.

qcsrc/server/arena.qc
qcsrc/server/bot/bot.qc
qcsrc/server/cl_player.qc

index 5dd01d4ddf58a18aafc5404bcce1045710658f0b..e68e295022f29ecfe2ef3e579f47caded8ecfdf8 100644 (file)
@@ -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;
index b4285304570c574c1ba0a8160e3da29ef12f1930..58dc1cf86d93e8fb344fcddd25b1342accf86e27 100644 (file)
@@ -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;
        }
index 7e73ea345bda2ef874b5baaaf88b752250d743cc..3a3a8a0d7ac9851cf7a3fcfa6644ec2873d7d7d3 100644 (file)
@@ -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)