Merge branch 'master' into 'master'
[xonotic/xonotic-data.pk3dir.git] / 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)
                // 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)
                bots = min(bots, maxclients - realplayers);
 
                if(bots > minbots)
@@ -636,7 +636,7 @@ bool bot_fixcount()
                                return false;
                        }
                }
                                return false;
                        }
                }
-               while (currentbots > bots)
+               while (currentbots > bots && bots >= 0)
                        bot_removenewest();
        }
 
                        bot_removenewest();
        }