]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix nJoinAllowed returning a negative amount of available player slots if g_maxplayer...
authorterencehill <piuntn@gmail.com>
Thu, 11 Jun 2020 19:14:41 +0000 (21:14 +0200)
committerterencehill <piuntn@gmail.com>
Thu, 11 Jun 2020 19:14:41 +0000 (21:14 +0200)
qcsrc/server/client.qc
qcsrc/server/defs.qh

index a0f5c8a38fc4e61c0457fd3549a6a40bb07a83ab..fe2952711f9cd8970ad815f6fa7fd091cbe7ee9c 100644 (file)
@@ -2018,10 +2018,10 @@ int nJoinAllowed(entity this, entity ignore)
 
        int player_limit = GetPlayerLimit();
 
-       float free_slots = 0;
+       int free_slots = 0;
        if (!player_limit)
                free_slots = maxclients - totalClients;
-       else if(currentlyPlaying < player_limit)
+       else if(player_limit > 0 && currentlyPlaying < player_limit)
                free_slots = min(maxclients - totalClients, player_limit - currentlyPlaying);
 
        static float msg_time = 0;
index a8ec77959af89a584a3b4f03b2806a04e2cb37b2..e12970a9c63d3d912c881170a7c94ddd6a9cfab0 100644 (file)
@@ -146,7 +146,7 @@ void checkSpectatorBlock(entity this);
 .float alivetime; // time of being alive
 .float motd_actived_time; // used for both motd and campaign_message
 
-bool nJoinAllowed(entity this, entity ignore);
+int nJoinAllowed(entity this, entity ignore);
 
 .float spawnshieldtime;
 .float item_spawnshieldtime;