float redalive, bluealive, yellowalive, pinkalive;
float totalalive;
.float redalive_stat, bluealive_stat, yellowalive_stat, pinkalive_stat;
-float redspawned, bluespawned, yellowspawned, pinkspawned;
-float totalspawned;
+float red_players, blue_players, yellow_players, pink_players;
+float total_players;
/**
* Resets the state of all clients, items, flags, runes, keys, weapons, waypoints, ... of the map.
}
}
-void count_spawned_players()
+void count_players()
{
- // TODO fix "*spawned" name, it should rather be "*players" or so
- // not doing this now to prevent merge hell with Tag
- // fix after merging with Tag
-
// count amount of players in each team
- totalspawned = redspawned = bluespawned = yellowspawned = pinkspawned = 0;
+ total_players = red_players = blue_players = yellow_players = pink_players = 0;
FOR_EACH_PLAYER(self) {
if (self.team == COLOR_TEAM1)
{
- redspawned += 1;
- totalspawned += 1;
+ red_players += 1;
+ total_players += 1;
}
else if (self.team == COLOR_TEAM2)
{
- bluespawned += 1;
- totalspawned += 1;
+ blue_players += 1;
+ total_players += 1;
}
else if (self.team == COLOR_TEAM3)
{
- yellowspawned += 1;
- totalspawned += 1;
+ yellow_players += 1;
+ total_players += 1;
}
else if (self.team == COLOR_TEAM4)
{
- pinkspawned += 1;
- totalspawned += 1;
+ pink_players += 1;
+ total_players += 1;
}
}
}
*/
void Spawnqueue_Check()
{
- count_spawned_players();
+ count_players();
if(g_ca || g_freezetag) // we want to perform this before the return block below (CA)...
{
count_alive_players();
if(g_ca) {
required_ca_players = max(2, fabs(autocvar_bot_vs_human + 1));
- if(ca_players < required_ca_players && (redspawned && bluespawned)) {
+ if(ca_players < required_ca_players && (red_players && blue_players)) {
reset_map(TRUE);
}
else if(ca_players < required_ca_players) {
return;
}
else if(!next_round) {
- if((redspawned && !bluespawned) || (bluespawned && !redspawned)) {
+ if((red_players && !blue_players) || (blue_players && !red_players)) {
next_round = time + 5;
champion = find(world, classname, "player");
if(champion_name)
strunzone(champion_name);
champion_name = strzone(champion.netname);
}
- else if((!redspawned && !bluespawned) || time - warmup > autocvar_g_ca_round_timelimit) {
+ else if((!red_players && !blue_players) || time - warmup > autocvar_g_ca_round_timelimit) {
FOR_EACH_CLIENT(self) centerprint(self, strcat("^7Round tied.", "^7\n"));
next_round = time + 5;
}
--totalalive;
}
- if(totalspawned > 2) // only check for winners if we had more than two players (one of them left, don't let the other player win just because of that)
+ if(total_players > 2) // only check for winners if we had more than two players (one of them left, don't let the other player win just because of that)
freezetag_CheckWinner();
freezetag_Unfreeze(world);
{
freezetag_Unfreeze(world); // start by making sure that all ice blocks are removed
- if(totalspawned == 1 && time > game_starttime) // only one player active on server, start a new match immediately
+ if(total_players == 1 && time > game_starttime) // only one player active on server, start a new match immediately
if(!next_round && warmup && (time < warmup - autocvar_g_freezetag_warmup || time > warmup)) // not awaiting next round
{
next_round = time;