Use the new player limit function for limiting bot count
authorMario <mario@smbclan.net>
Sun, 30 Sep 2018 12:29:06 +0000 (22:29 +1000)
committerMario <mario@smbclan.net>
Sun, 30 Sep 2018 12:29:06 +0000 (22:29 +1000)
qcsrc/server/bot/default/bot.qc

index d9d05773e42b949b1b19522cd1c5246bee1cb7b0..0c4668f2f38d3c05eeb5b24e3ff8d44cb861d753 100644 (file)
@@ -593,7 +593,6 @@ float bot_fixcount()
                });
        }
 
-       //int player_limit = GetPlayerLimit(); // TODO: use this instead of maxclients!
        int bots;
        // But don't remove bots immediately on level change, as the real players
        // usually haven't rejoined yet
@@ -608,8 +607,9 @@ float bot_fixcount()
                // add bots to reach minplayers if needed
                bots = max(minbots, minplayers - activerealplayers);
                // cap bots to the max players allowed by the server
-               if(autocvar_g_maxplayers)
-                       bots = min(bots, autocvar_g_maxplayers - activerealplayers);
+               int player_limit = GetPlayerLimit();
+               if(player_limit)
+                       bots = min(bots, player_limit - activerealplayers);
                bots = min(bots, maxclients - realplayers);
 
                if(bots > minbots)