Skip to content

Commit

Permalink
MapRotation : add 'numConnectedPlayers' to level_locals_s
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimitriio authored and illwieckz committed Jan 5, 2020
1 parent 2adfc0d commit c2763a4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
2 changes: 2 additions & 0 deletions src/sgame/sg_main.cpp
Expand Up @@ -1421,6 +1421,7 @@ void CalculateRanks()
char P[ MAX_CLIENTS + 1 ] = "", B[ MAX_CLIENTS + 1 ] = ""; char P[ MAX_CLIENTS + 1 ] = "", B[ MAX_CLIENTS + 1 ] = "";


level.numConnectedClients = 0; level.numConnectedClients = 0;
level.numConnectedPlayers = 0;
level.numPlayingClients = 0; level.numPlayingClients = 0;
level.numPlayingPlayers = 0; level.numPlayingPlayers = 0;
level.numPlayingBots = 0; level.numPlayingBots = 0;
Expand Down Expand Up @@ -1469,6 +1470,7 @@ void CalculateRanks()
else else
{ {
level.team[ team ].numPlayers++; level.team[ team ].numPlayers++;
level.numConnectedPlayers++;
} }


if ( level.clients[ clientNum ].pers.connected != CON_CONNECTED ) if ( level.clients[ clientNum ].pers.connected != CON_CONNECTED )
Expand Down
10 changes: 1 addition & 9 deletions src/sgame/sg_maprotation.cpp
Expand Up @@ -1199,15 +1199,7 @@ static bool G_EvaluateMapCondition( mrCondition_t **condition )
break; break;


case CV_NUMPLAYERS: case CV_NUMPLAYERS:
{ result = G_EvaluateIntegerCondition(localCondition, level.numConnectedPlayers);
int numPlayers = 0;
for ( int team = TEAM_NONE; team < NUM_TEAMS; team++ )
{
numPlayers += level.team[ team ].numPlayers;
}

result = G_EvaluateIntegerCondition(localCondition, numPlayers);
}
break; break;


case CV_NUMCLIENTS: case CV_NUMCLIENTS:
Expand Down
1 change: 1 addition & 0 deletions src/sgame/sg_struct.h
Expand Up @@ -624,6 +624,7 @@ struct level_locals_s
bool restarted; // waiting for a map_restart to fire bool restarted; // waiting for a map_restart to fire


int numConnectedClients; // connected int numConnectedClients; // connected
int numConnectedPlayers; // connected players (not bot) in a team or spec mode
int numAliveClients; // on a team and alive int numAliveClients; // on a team and alive
int numPlayingClients; // on a team int numPlayingClients; // on a team
int numPlayingPlayers; // on a team and not a bot int numPlayingPlayers; // on a team and not a bot
Expand Down

0 comments on commit c2763a4

Please sign in to comment.