]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/bot/default/bot.qc
Very minor cleanups
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / bot / default / bot.qc
index 2a6164a2826875af507597ba8523bf629bee0403..9ebcffae3c8383657da46d4b571e24dfcdd92b2a 100644 (file)
@@ -41,6 +41,8 @@
 #include <lib/warpzone/common.qh>
 #include <lib/warpzone/util_server.qh>
 
+STATIC_INIT(bot) { bot_calculate_stepheightvec(); }
+
 // TODO: remove this function! its only purpose is to update these fields since bot_setnameandstuff is called before ClientState
 void bot_setclientfields(entity this)
 {
@@ -578,7 +580,7 @@ void bot_calculate_stepheightvec()
        jumpstepheightvec = stepheightvec + jumpheight_vec * 0.85; // reduce it a bit to make the jumps easy
 }
 
-float bot_fixcount()
+bool bot_fixcount()
 {
        int activerealplayers = 0;
        int realplayers = 0;
@@ -607,6 +609,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
+               int player_limit = GetPlayerLimit();
+               if(player_limit)
+                       bots = min(bots, player_limit - activerealplayers);
                bots = min(bots, maxclients - realplayers);
 
                if(bots > minbots)