-};
-
-
-
-// player has joined game, get him on a team
-// depreciated
-/*void dom_player_join_team(entity pl)
-{
- entity head;
- float c1, c2, c3, c4, totalteams, smallestteam, smallestteam_count, selectedteam;
- float balance_teams, force_balance, balance_type;
-
- balance_teams = autocvar_g_balance_teams;
- balance_teams = autocvar_g_balance_teams_force;
-
- c1 = c2 = c3 = c4 = -1;
- totalteams = 0;
-
- // first find out what teams are allowed
- head = find(world, classname, "dom_team");
- while(head)
- {
- if(head.netname != "")
- {
- //if(head.team == pl.team)
- // selected = head;
- if(head.team == COLOR_TEAM1)
- {
- c1 = 0;
- }
- if(head.team == COLOR_TEAM2)
- {
- c2 = 0;
- }
- if(head.team == COLOR_TEAM3)
- {
- c3 = 0;
- }
- if(head.team == COLOR_TEAM4)
- {
- c4 = 0;
- }
- }
- head = find(head, classname, "dom_team");
- }
-
- // make sure there are at least 2 teams to join
- if(c1 >= 0)
- totalteams = totalteams + 1;
- if(c2 >= 0)
- totalteams = totalteams + 1;
- if(c3 >= 0)
- totalteams = totalteams + 1;
- if(c4 >= 0)
- totalteams = totalteams + 1;
-
- if(totalteams <= 1)
- error("dom_player_join_team: Too few teams available for domination\n");
-
- // whichever teams that are available are set to 0 instead of -1
-
- // if we don't care what team he ends up on, put him on whatever team he entered as.
- // if he's not on a valid team, then put him on the smallest team
- if(!balance_teams && !force_balance)
- {
- if( c1 >= 0 && pl.team == COLOR_TEAM1)
- selectedteam = pl.team;
- else if(c2 >= 0 && pl.team == COLOR_TEAM2)
- selectedteam = pl.team;
- else if(c3 >= 0 && pl.team == COLOR_TEAM3)
- selectedteam = pl.team;
- else if(c4 >= 0 && pl.team == COLOR_TEAM4)
- selectedteam = pl.team;
- else
- selectedteam = -1;
- if(selectedteam > 0)
- {
- SetPlayerColors(pl, selectedteam - 1);
- return;
- }
- // otherwise end up on the smallest team (handled below)
- }
-
- // now count how many players are on each team already
-
- head = find(world, classname, "player");
- while(head)
- {
- //if(head.netname != "")
- {
- if(head.team == COLOR_TEAM1)
- {
- if(c1 >= 0)
- c1 = c1 + 1;
- }
- if(head.team == COLOR_TEAM2)
- {
- if(c2 >= 0)
- c2 = c2 + 1;
- }
- if(head.team == COLOR_TEAM3)
- {
- if(c3 >= 0)
- c3 = c3 + 1;
- }
- if(head.team == COLOR_TEAM4)
- {
- if(c4 >= 0)
- c4 = c4 + 1;
- }
- }
- head = find(head, classname, "player");
- }
-
- // c1...c4 now have counts of each team
- // figure out which is smallest, giving priority to the team the player is already on as a tie-breaker