]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into 'master'
authorterencehill <piuntn@gmail.com>
Sat, 16 Feb 2019 23:08:47 +0000 (23:08 +0000)
committerterencehill <piuntn@gmail.com>
Sat, 16 Feb 2019 23:08:47 +0000 (23:08 +0000)
Fix crash when g_maxplayers smaller than current amount of active players

See merge request xonotic/xonotic-data.pk3dir!637

qcsrc/server/bot/default/bot.qc

index 03f539383e5bd2e1471b3bab1ae482f03c1a0303..3911d596dc51859afd8058272ec394bf402014a7 100644 (file)
@@ -613,7 +613,7 @@ bool bot_fixcount()
                // cap bots to the max players allowed by the server
                int player_limit = GetPlayerLimit();
                if(player_limit)
-                       bots = min(bots, player_limit - activerealplayers);
+                       bots = min(bots, max(player_limit - activerealplayers, 0));
                bots = min(bots, maxclients - realplayers);
 
                if(bots > minbots)
@@ -636,7 +636,7 @@ bool bot_fixcount()
                                return false;
                        }
                }
-               while (currentbots > bots)
+               while (currentbots > bots && bots >= 0)
                        bot_removenewest();
        }