]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Anticipate g_maxplayers check so it doesn't cause weird issues when trying to join...
authorterencehill <piuntn@gmail.com>
Thu, 25 Aug 2016 00:10:05 +0000 (02:10 +0200)
committerterencehill <piuntn@gmail.com>
Thu, 25 Aug 2016 00:10:05 +0000 (02:10 +0200)
qcsrc/server/client.qc

index c9a8dd5d85ace0cad09a42669496b48384d05477..90ed7d4cf3f8c72cf013f9d0262c355fffb70e9e 100644 (file)
@@ -1864,36 +1864,28 @@ void ShowRespawnCountdown(entity this)
 .int team_selected;
 void LeaveSpectatorMode(entity this)
 {
-       if(nJoinAllowed(this, this))
+       if(!teamplay || autocvar_g_campaign || autocvar_g_balance_teams || this.team_selected || (this.wasplayer && autocvar_g_changeteam_banned) || this.team_forced > 0)
        {
-               if(!teamplay || autocvar_g_campaign || autocvar_g_balance_teams || this.team_selected || (this.wasplayer && autocvar_g_changeteam_banned) || this.team_forced > 0)
-               {
-                       TRANSMUTE(Player, this);
+               TRANSMUTE(Player, this);
 
-                       SetSpectatee(this, NULL);
+               SetSpectatee(this, NULL);
 
-                       if(autocvar_g_campaign || autocvar_g_balance_teams)
-                               { JoinBestTeam(this, false, true); }
+               if(autocvar_g_campaign || autocvar_g_balance_teams)
+                       { JoinBestTeam(this, false, true); }
 
-                       if(autocvar_g_campaign)
-                               { campaign_bots_may_start = true; }
+               if(autocvar_g_campaign)
+                       { campaign_bots_may_start = true; }
 
-                       Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_PREVENT_JOIN);
+               Kill_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CPID_PREVENT_JOIN);
 
-                       PutClientInServer(this);
-                       PlayerScore_Clear(this);
+               PutClientInServer(this);
+               PlayerScore_Clear(this);
 
-                       if(IS_PLAYER(this)) { Send_Notification(NOTIF_ALL, NULL, MSG_INFO, ((teamplay && this.team != -1) ? APP_TEAM_ENT(this, INFO_JOIN_PLAY_TEAM) : INFO_JOIN_PLAY), this.netname); }
-                       this.team_selected = false;
-               }
-               else
-                       stuffcmd(this, "menu_showteamselect\n");
+               if(IS_PLAYER(this)) { Send_Notification(NOTIF_ALL, NULL, MSG_INFO, ((teamplay && this.team != -1) ? APP_TEAM_ENT(this, INFO_JOIN_PLAY_TEAM) : INFO_JOIN_PLAY), this.netname); }
+               this.team_selected = false;
        }
        else
-       {
-               // Player may not join because g_maxplayers is set
-               Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_JOIN_PREVENT);
-       }
+               stuffcmd(this, "menu_showteamselect\n");
 }
 
 /**
@@ -2006,6 +1998,12 @@ bool spawnAllowed(entity this)
        if (this.version_mismatch) return false;
        if (teamplay && lockteams) return false;
        if (MUTATOR_CALLHOOK(ForbidSpawn, this)) return false;
+       if (!nJoinAllowed(this, this))
+       {
+               // Player may not join because g_maxplayers is set
+               Send_Notification(NOTIF_ONE_ONLY, this, MSG_CENTER, CENTER_JOIN_PREVENT);
+               return false;
+       }
        return true;
 }