Gamerules: Some maps use a func_buyzone with no team attached to restrict buying, so check for team == 0

in Create{T,CT}Buyzones().
Also fix a round restart loop when the opposing team is empty but more than 2 players are present.
This commit is contained in:
Marco Cawthorne 2022-04-26 13:03:12 -07:00
parent 360f00f3d1
commit 1dc0e57415
Signed by: eukara
GPG key ID: C196CD8BA993248A

View file

@ -158,7 +158,7 @@ CSMultiplayerRules::CreateCTBuyzones(void)
/* count the already existing CT zones. */
for (entity e = world; (e = find(e, ::classname, "func_buyzone"));) {
if (e.team == TEAM_CT) {
if (e.team == 0 || e.team == TEAM_CT) {
zones++;
}
}
@ -182,7 +182,7 @@ CSMultiplayerRules::CreateTBuyzones(void)
/* count the already existing T zones. */
for (entity e = world; (e = find(e, ::classname, "func_buyzone"));) {
if (e.team == TEAM_T) {
if (e.team == 0 || e.team == TEAM_T) {
zones++;
}
}
@ -231,7 +231,7 @@ CSMultiplayerRules::TimerBegin(float tleft, int mode)
g_cs_gamestate = GAME_ACTIVE;
CountPlayers();
if (g_total_players < 2)
if (g_cs_total_t <= 1 || g_cs_total_ct <= 1)
return;
/* if no players are present in the chosen team, force restart round */
@ -352,7 +352,7 @@ CSMultiplayerRules::BuyingPossible(base_player pl)
return (0);
}
}
if (pl.team == TEAM_VIP) {
centerprint(pl, "You are the VIP...\nYou can't buy anything!\n");
return (0);