From: terencehill Date: Thu, 11 Jun 2020 19:14:41 +0000 (+0200) Subject: Fix nJoinAllowed returning a negative amount of available player slots if g_maxplayer... X-Git-Tag: xonotic-v0.8.5~923 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=1f79db212536f24f697c934d3e50f1870705e2a7;hp=b654761694a84d3714332384cfef1ae387c567b7 Fix nJoinAllowed returning a negative amount of available player slots if g_maxplayers is negative --- diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index a0f5c8a38..fe2952711 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -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; diff --git a/qcsrc/server/defs.qh b/qcsrc/server/defs.qh index a8ec77959..e12970a9c 100644 --- a/qcsrc/server/defs.qh +++ b/qcsrc/server/defs.qh @@ -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;