6 #include "scores_rules.qh"
10 #include "command/vote.qh"
12 #include "mutators/_mod.qh"
14 #include "../common/deathtypes/all.qh"
15 #include "../common/gamemodes/_mod.qh"
16 #include "../common/teams.qh"
18 void TeamchangeFrags(entity e)
23 void LogTeamchange(float player_id, float team_number, float type)
25 if(!autocvar_sv_eventlog)
31 GameLogEcho(strcat(":team:", ftos(player_id), ":", ftos(team_number), ":", ftos(type)));
34 void default_delayedinit(entity this)
36 if(!scores_initialized)
40 void InitGameplayMode()
44 // find out good world mins/maxs bounds, either the static bounds found by looking for solid, or the mapinfo specified bounds
46 // assign reflectively to avoid "assignment to world" warning
47 int done = 0; for (int i = 0, n = numentityfields(); i < n; ++i) {
48 string k = entityfieldname(i); vector v = (k == "mins") ? mi_min : (k == "maxs") ? mi_max : '0 0 0';
50 putentityfieldstring(i, world, sprintf("%v", v));
51 if (++done == 2) break;
54 // currently, NetRadiant's limit is 131072 qu for each side
55 // distance from one corner of a 131072qu cube to the opposite corner is approx. 227023 qu
56 // set the distance according to map size but don't go over the limit to avoid issues with float precision
57 // in case somebody makes extremely large maps
58 max_shot_distance = min(230000, vlen(world.maxs - world.mins));
60 MapInfo_LoadMapSettings(mapname);
61 GameRules_teams(false);
63 if (!cvar_value_issafe(world.fog))
65 LOG_INFO("The current map contains a potentially harmful fog setting, ignored");
66 world.fog = string_null;
68 if(MapInfo_Map_fog != "")
69 if(MapInfo_Map_fog == "none")
70 world.fog = string_null;
72 world.fog = strzone(MapInfo_Map_fog);
73 clientstuff = strzone(MapInfo_Map_clientstuff);
77 gamemode_name = MapInfo_Type_ToText(MapInfo_LoadedGametype);
79 cache_mutatormsg = strzone("");
80 cache_lastmutatormsg = strzone("");
82 InitializeEntity(NULL, default_delayedinit, INITPRIO_GAMETYPE_FALLBACK);
85 string GetClientVersionMessage(entity this)
87 if (CS(this).version_mismatch) {
88 if(CS(this).version < autocvar_gameversion) {
89 return strcat("This is Xonotic ", autocvar_g_xonoticversion,
90 "\n^3Your client version is outdated.\n\n\n### YOU WON'T BE ABLE TO PLAY ON THIS SERVER ###\n\n\nPlease update!!!^8");
92 return strcat("This is Xonotic ", autocvar_g_xonoticversion,
93 "\n^3This server is using an outdated Xonotic version.\n\n\n ### THIS SERVER IS INCOMPATIBLE AND THUS YOU CANNOT JOIN ###.^8");
96 return strcat("Welcome to Xonotic ", autocvar_g_xonoticversion);
100 string getwelcomemessage(entity this)
102 MUTATOR_CALLHOOK(BuildMutatorsPrettyString, "");
103 string modifications = M_ARGV(0, string);
107 if(g_weaponarena_random)
108 modifications = strcat(modifications, ", ", ftos(g_weaponarena_random), " of ", g_weaponarena_list, " Arena");
110 modifications = strcat(modifications, ", ", g_weaponarena_list, " Arena");
112 else if(cvar("g_balance_blaster_weaponstartoverride") == 0)
113 modifications = strcat(modifications, ", No start weapons");
114 if(cvar("sv_gravity") < stof(cvar_defstring("sv_gravity")))
115 modifications = strcat(modifications, ", Low gravity");
116 if(g_weapon_stay && !g_cts)
117 modifications = strcat(modifications, ", Weapons stay");
119 modifications = strcat(modifications, ", Jet pack");
120 if(autocvar_g_powerups == 0)
121 modifications = strcat(modifications, ", No powerups");
122 if(autocvar_g_powerups > 0)
123 modifications = strcat(modifications, ", Powerups");
124 modifications = substring(modifications, 2, strlen(modifications) - 2);
126 string versionmessage = GetClientVersionMessage(this);
127 string s = strcat(versionmessage, "^8\n^8\nmatch type is ^1", gamemode_name, "^8\n");
129 if(modifications != "")
130 s = strcat(s, "^8\nactive modifications: ^3", modifications, "^8\n");
132 if(cache_lastmutatormsg != autocvar_g_mutatormsg)
134 if(cache_lastmutatormsg)
135 strunzone(cache_lastmutatormsg);
137 strunzone(cache_mutatormsg);
138 cache_lastmutatormsg = strzone(autocvar_g_mutatormsg);
139 cache_mutatormsg = strzone(cache_lastmutatormsg);
142 if (cache_mutatormsg != "") {
143 s = strcat(s, "\n\n^8special gameplay tips: ^7", cache_mutatormsg);
146 string mutator_msg = "";
147 MUTATOR_CALLHOOK(BuildGameplayTipsString, mutator_msg);
148 mutator_msg = M_ARGV(0, string);
150 s = strcat(s, mutator_msg); // trust that the mutator will do proper formatting
152 string motd = autocvar_sv_motd;
154 s = strcat(s, "\n\n^8MOTD: ^7", strreplace("\\n", "\n", motd));
159 void setcolor(entity this, int clr)
162 this.clientcolors = clr;
163 this.team = (clr & 15) + 1;
165 builtin_setcolor(this, clr);
169 void SetPlayerColors(entity player, float _color)
171 float pants = _color & 0x0F;
172 float shirt = _color & 0xF0;
175 setcolor(player, 16 * pants + pants);
179 setcolor(player, shirt + pants);
183 void KillPlayerForTeamChange(entity player)
189 if (MUTATOR_CALLHOOK(Player_ChangeTeamKill, player) == true)
193 Damage(player, player, player, 100000, DEATH_TEAMCHANGE.m_id, player.origin,
197 bool SetPlayerTeamSimple(entity player, int team_num)
199 if (player.team == team_num)
201 // This is important when players join the game and one of their color
202 // matches the team color while other doesn't. For example [BOT]Lion.
203 SetPlayerColors(player, team_num - 1);
206 if (MUTATOR_CALLHOOK(Player_ChangeTeam, player, Team_TeamToNumber(
207 player.team), Team_TeamToNumber(team_num)) == true)
209 // Mutator has blocked team change.
212 int old_team = player.team;
213 SetPlayerColors(player, team_num - 1);
214 MUTATOR_CALLHOOK(Player_ChangedTeam, player, old_team, player.team);
218 bool SetPlayerTeam(entity player, int destination_team, int source_team,
221 int team_num = Team_NumberToTeam(destination_team);
222 if (!SetPlayerTeamSimple(player, team_num))
226 LogTeamchange(player.playerid, player.team, 3); // log manual team join
231 bprint(playername(player, false), "^7 has changed from ", Team_NumberToColoredFullName(source_team), "^7 to ", Team_NumberToColoredFullName(destination_team), "\n");
235 // set c1...c4 to show what teams are allowed
236 void CheckAllowedTeams(entity for_whom)
240 c1 = c2 = c3 = c4 = -1;
241 num_bots_team1 = num_bots_team2 = num_bots_team3 = num_bots_team4 = 0;
243 string teament_name = string_null;
245 bool mutator_returnvalue = MUTATOR_CALLHOOK(CheckAllowedTeams, teams_mask, teament_name, for_whom);
246 teams_mask = M_ARGV(0, float);
247 teament_name = M_ARGV(1, string);
249 if(!mutator_returnvalue)
251 if(teams_mask & BIT(0)) c1 = 0;
252 if(teams_mask & BIT(1)) c2 = 0;
253 if(teams_mask & BIT(2)) c3 = 0;
254 if(teams_mask & BIT(3)) c4 = 0;
257 // find out what teams are allowed if necessary
260 entity head = find(NULL, classname, teament_name);
265 case NUM_TEAM_1: c1 = 0; break;
266 case NUM_TEAM_2: c2 = 0; break;
267 case NUM_TEAM_3: c3 = 0; break;
268 case NUM_TEAM_4: c4 = 0; break;
271 head = find(head, classname, teament_name);
275 // TODO: Balance quantity of bots across > 2 teams when bot_vs_human is set (and remove next line)
276 if(AvailableTeams() == 2)
277 if(autocvar_bot_vs_human && for_whom)
279 if(autocvar_bot_vs_human > 0)
281 // find last team available
283 if(IS_BOT_CLIENT(for_whom))
285 if(c4 >= 0) { c3 = c2 = c1 = -1; }
286 else if(c3 >= 0) { c4 = c2 = c1 = -1; }
287 else { c4 = c3 = c1 = -1; }
288 // no further cases, we know at least 2 teams exist
292 if(c1 >= 0) { c2 = c3 = c4 = -1; }
293 else if(c2 >= 0) { c1 = c3 = c4 = -1; }
294 else { c1 = c2 = c4 = -1; }
295 // no further cases, bots have one of the teams
300 // find first team available
302 if(IS_BOT_CLIENT(for_whom))
304 if(c1 >= 0) { c2 = c3 = c4 = -1; }
305 else if(c2 >= 0) { c1 = c3 = c4 = -1; }
306 else { c1 = c2 = c4 = -1; }
307 // no further cases, we know at least 2 teams exist
311 if(c4 >= 0) { c3 = c2 = c1 = -1; }
312 else if(c3 >= 0) { c4 = c2 = c1 = -1; }
313 else { c4 = c3 = c1 = -1; }
314 // no further cases, bots have one of the teams
322 // if player has a forced team, ONLY allow that one
323 if(for_whom.team_forced == NUM_TEAM_1 && c1 >= 0)
325 else if(for_whom.team_forced == NUM_TEAM_2 && c2 >= 0)
327 else if(for_whom.team_forced == NUM_TEAM_3 && c3 >= 0)
329 else if(for_whom.team_forced == NUM_TEAM_4 && c4 >= 0)
333 float PlayerValue(entity p)
336 // FIXME: it always returns 1...
339 // c1...c4 should be set to -1 (not allowed) or 0 (allowed).
340 // teams that are allowed will now have their player counts stored in c1...c4
341 void GetTeamCounts(entity ignore)
343 if (MUTATOR_CALLHOOK(GetTeamCounts) == true)
347 MUTATOR_CALLHOOK(GetTeamCount, NUM_TEAM_1, ignore, c1,
348 num_bots_team1, lowest_human_team1, lowest_bot_team1);
349 c1 = M_ARGV(2, float);
350 num_bots_team1 = M_ARGV(3, float);
351 lowest_human_team1 = M_ARGV(4, entity);
352 lowest_bot_team1 = M_ARGV(5, entity);
356 MUTATOR_CALLHOOK(GetTeamCount, NUM_TEAM_2, ignore, c2,
357 num_bots_team2, lowest_human_team2, lowest_bot_team2);
358 c2 = M_ARGV(2, float);
359 num_bots_team2 = M_ARGV(3, float);
360 lowest_human_team2 = M_ARGV(4, entity);
361 lowest_bot_team2 = M_ARGV(5, entity);
365 MUTATOR_CALLHOOK(GetTeamCount, NUM_TEAM_3, ignore, c3,
366 num_bots_team3, lowest_human_team3, lowest_bot_team3);
367 c3 = M_ARGV(2, float);
368 num_bots_team3 = M_ARGV(3, float);
369 lowest_human_team3 = M_ARGV(4, entity);
370 lowest_bot_team3 = M_ARGV(5, entity);
374 MUTATOR_CALLHOOK(GetTeamCount, NUM_TEAM_4, ignore,
375 c4, num_bots_team4, lowest_human_team4, lowest_bot_team4);
376 c4 = M_ARGV(2, float);
377 num_bots_team4 = M_ARGV(3, float);
378 lowest_human_team4 = M_ARGV(4, entity);
379 lowest_bot_team4 = M_ARGV(5, entity);
385 // now count how many players are on each team already
386 float lowest_human_score1 = FLOAT_MAX;
387 float lowest_bot_score1 = FLOAT_MAX;
388 float lowest_human_score2 = FLOAT_MAX;
389 float lowest_bot_score2 = FLOAT_MAX;
390 float lowest_human_score3 = FLOAT_MAX;
391 float lowest_bot_score3 = FLOAT_MAX;
392 float lowest_human_score4 = FLOAT_MAX;
393 float lowest_bot_score4 = FLOAT_MAX;
397 if (IS_PLAYER(it) || it.caplayer)
401 else if (it.team_forced > 0)
403 t = it.team_forced; // reserve the spot
413 value = PlayerValue(it);
414 if (IS_BOT_CLIENT(it))
435 num_bots_team1 += bvalue;
436 float temp_score = PlayerScore_Get(it, SP_SCORE);
439 if (temp_score < lowest_human_score1)
441 lowest_human_team1 = it;
442 lowest_human_score1 = temp_score;
446 if (temp_score < lowest_bot_score1)
448 lowest_bot_team1 = it;
449 lowest_bot_score1 = temp_score;
460 num_bots_team2 += bvalue;
461 float temp_score = PlayerScore_Get(it, SP_SCORE);
464 if (temp_score < lowest_human_score2)
466 lowest_human_team2 = it;
467 lowest_human_score2 = temp_score;
471 if (temp_score < lowest_bot_score2)
473 lowest_bot_team2 = it;
474 lowest_bot_score2 = temp_score;
485 num_bots_team3 += bvalue;
486 float temp_score = PlayerScore_Get(it, SP_SCORE);
489 if (temp_score < lowest_human_score3)
491 lowest_human_team3 = it;
492 lowest_human_score3 = temp_score;
496 if (temp_score < lowest_bot_score3)
498 lowest_bot_team3 = it;
499 lowest_bot_score3 = temp_score;
510 num_bots_team4 += bvalue;
511 float temp_score = PlayerScore_Get(it, SP_SCORE);
514 if (temp_score < lowest_human_score4)
516 lowest_human_team4 = it;
517 lowest_human_score4 = temp_score;
521 if (temp_score < lowest_bot_score4)
523 lowest_bot_team4 = it;
524 lowest_bot_score4 = temp_score;
532 // if the player who has a forced team has not joined yet, reserve the spot
533 if(autocvar_g_campaign)
535 switch(autocvar_g_campaign_forceteam)
537 case 1: if(c1 == num_bots_team1) ++c1; break;
538 case 2: if(c2 == num_bots_team2) ++c2; break;
539 case 3: if(c3 == num_bots_team3) ++c3; break;
540 case 4: if(c4 == num_bots_team4) ++c4; break;
545 bool IsTeamSmallerThanTeam(int team_a, int team_b, entity player,
548 if (!Team_IsValidNumber(team_a))
550 LOG_FATALF("IsTeamSmallerThanTeam: team_a is invalid: %f", team_a);
552 if (!Team_IsValidNumber(team_b))
554 LOG_FATALF("IsTeamSmallerThanTeam: team_b is invalid: %f", team_b);
556 if (team_a == team_b)
560 // we assume that CheckAllowedTeams and GetTeamCounts have already been called
561 int num_players_team_a = -1, num_players_team_b = -1;
562 int num_bots_team_a = 0, num_bots_team_b = 0;
563 float score_team_a = 0, score_team_b = 0;
568 num_players_team_a = c1;
569 num_bots_team_a = num_bots_team1;
570 score_team_a = team1_score;
575 num_players_team_a = c2;
576 num_bots_team_a = num_bots_team2;
577 score_team_a = team2_score;
582 num_players_team_a = c3;
583 num_bots_team_a = num_bots_team3;
584 score_team_a = team3_score;
589 num_players_team_a = c4;
590 num_bots_team_a = num_bots_team4;
591 score_team_a = team4_score;
599 num_players_team_b = c1;
600 num_bots_team_b = num_bots_team1;
601 score_team_b = team1_score;
606 num_players_team_b = c2;
607 num_bots_team_b = num_bots_team2;
608 score_team_b = team2_score;
613 num_players_team_b = c3;
614 num_bots_team_b = num_bots_team3;
615 score_team_b = team3_score;
620 num_players_team_b = c4;
621 num_bots_team_b = num_bots_team4;
622 score_team_b = team4_score;
627 if (num_players_team_a < 0 || num_players_team_b < 0)
631 if (IS_REAL_CLIENT(player) && bots_would_leave)
633 num_players_team_a -= num_bots_team_a;
634 num_players_team_b -= num_bots_team_b;
638 return num_players_team_a < num_players_team_b;
640 if (num_players_team_a < num_players_team_b)
644 if (num_players_team_a > num_players_team_b)
648 return score_team_a < score_team_b;
651 bool IsTeamEqualToTeam(int team_a, int team_b, entity player, bool use_score)
653 if (!Team_IsValidNumber(team_a))
655 LOG_FATALF("IsTeamEqualToTeam: team_a is invalid: %f", team_a);
657 if (!Team_IsValidNumber(team_b))
659 LOG_FATALF("IsTeamEqualToTeam: team_b is invalid: %f", team_b);
661 if (team_a == team_b)
665 // we assume that CheckAllowedTeams and GetTeamCounts have already been called
666 int num_players_team_a = -1, num_players_team_b = -1;
667 int num_bots_team_a = 0, num_bots_team_b = 0;
668 float score_team_a = 0, score_team_b = 0;
673 num_players_team_a = c1;
674 num_bots_team_a = num_bots_team1;
675 score_team_a = team1_score;
680 num_players_team_a = c2;
681 num_bots_team_a = num_bots_team2;
682 score_team_a = team2_score;
687 num_players_team_a = c3;
688 num_bots_team_a = num_bots_team3;
689 score_team_a = team3_score;
694 num_players_team_a = c4;
695 num_bots_team_a = num_bots_team4;
696 score_team_a = team4_score;
704 num_players_team_b = c1;
705 num_bots_team_b = num_bots_team1;
706 score_team_b = team1_score;
711 num_players_team_b = c2;
712 num_bots_team_b = num_bots_team2;
713 score_team_b = team2_score;
718 num_players_team_b = c3;
719 num_bots_team_b = num_bots_team3;
720 score_team_b = team3_score;
725 num_players_team_b = c4;
726 num_bots_team_b = num_bots_team4;
727 score_team_b = team4_score;
732 if (num_players_team_a < 0 || num_players_team_b < 0)
735 if (IS_REAL_CLIENT(player) && bots_would_leave)
737 num_players_team_a -= num_bots_team_a;
738 num_players_team_b -= num_bots_team_b;
742 return num_players_team_a == num_players_team_b;
744 if (num_players_team_a != num_players_team_b)
748 return score_team_a == score_team_b;
751 int FindBestTeams(entity player, bool use_score)
753 if (MUTATOR_CALLHOOK(FindBestTeams, player) == true)
755 return M_ARGV(1, float);
758 int previous_team = 0;
766 if (previous_team == 0)
771 else if (IsTeamSmallerThanTeam(2, previous_team, player, use_score))
776 else if (IsTeamEqualToTeam(2, previous_team, player, use_score))
784 if (previous_team == 0)
789 else if (IsTeamSmallerThanTeam(3, previous_team, player, use_score))
794 else if (IsTeamEqualToTeam(3, previous_team, player, use_score))
802 if (previous_team == 0)
806 else if (IsTeamSmallerThanTeam(4, previous_team, player, use_score))
810 else if (IsTeamEqualToTeam(4, previous_team, player, use_score))
818 // returns # of smallest team (1, 2, 3, 4)
819 // NOTE: Assumes CheckAllowedTeams has already been called!
820 int FindSmallestTeam(entity player, float ignore_player)
822 // count how many players are in each team
825 GetTeamCounts(player);
831 int team_bits = FindBestTeams(player, true);
834 error(sprintf("No teams available for %s\n", MapInfo_Type_ToString(MapInfo_CurrentGametype())));
836 RandomSelection_Init();
837 if ((team_bits & BIT(0)) != 0)
839 RandomSelection_AddFloat(1, 1, 1);
841 if ((team_bits & BIT(1)) != 0)
843 RandomSelection_AddFloat(2, 1, 1);
845 if ((team_bits & BIT(2)) != 0)
847 RandomSelection_AddFloat(3, 1, 1);
849 if ((team_bits & BIT(3)) != 0)
851 RandomSelection_AddFloat(4, 1, 1);
853 return RandomSelection_chosen_float;
856 void JoinBestTeam(entity this, bool force_best_team)
858 // don't join a team if we're not playing a team game
864 // find out what teams are available
865 CheckAllowedTeams(this);
867 // if we don't care what team they end up on, put them on whatever team they entered as.
868 // if they're not on a valid team, then let other code put them on the smallest team
869 if (!force_best_team)
872 if ((c1 >= 0) && (this.team == NUM_TEAM_1))
874 selected_team = this.team;
876 else if ((c2 >= 0) && (this.team == NUM_TEAM_2))
878 selected_team = this.team;
880 else if ((c3 >= 0) && (this.team == NUM_TEAM_3))
882 selected_team = this.team;
884 else if ((c4 >= 0) && (this.team == NUM_TEAM_4))
886 selected_team = this.team;
893 if (selected_team > 0)
895 SetPlayerTeamSimple(this, selected_team);
896 LogTeamchange(this.playerid, this.team, 99);
900 // otherwise end up on the smallest team (handled below)
901 if (this.bot_forced_team)
905 int best_team = FindSmallestTeam(this, true);
906 best_team = Team_NumberToTeam(best_team);
909 error("JoinBestTeam: invalid team\n");
911 int old_team = Team_TeamToNumber(this.team);
912 TeamchangeFrags(this);
913 SetPlayerTeamSimple(this, best_team);
914 LogTeamchange(this.playerid, this.team, 2); // log auto join
915 if ((old_team != -1) && !IS_BOT_CLIENT(this))
917 AutoBalanceBots(old_team, Team_TeamToNumber(best_team));
919 KillPlayerForTeamChange(this);
922 void SV_ChangeTeam(entity this, float _color)
924 float source_color, destination_color, source_team, destination_team;
926 // in normal deathmatch we can just apply the color and we're done
928 SetPlayerColors(this, _color);
932 // since this is an engine function, and gamecode doesn't have any calls earlier than this, do the connecting message here
933 Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_CONNECTING, this.netname);
940 source_color = this.clientcolors & 0x0F;
941 destination_color = _color & 0x0F;
943 source_team = Team_TeamToNumber(source_color + 1);
944 destination_team = Team_TeamToNumber(destination_color + 1);
946 if (destination_team == -1)
951 CheckAllowedTeams(this);
953 if (destination_team == 1 && c1 < 0) destination_team = 4;
954 if (destination_team == 4 && c4 < 0) destination_team = 3;
955 if (destination_team == 3 && c3 < 0) destination_team = 2;
956 if (destination_team == 2 && c2 < 0) destination_team = 1;
958 // not changing teams
959 if (source_color == destination_color)
961 SetPlayerTeam(this, destination_team, source_team, true);
965 if((autocvar_g_campaign) || (autocvar_g_changeteam_banned && CS(this).wasplayer)) {
966 Send_Notification(NOTIF_ONE, this, MSG_INFO, INFO_TEAMCHANGE_NOTALLOWED);
967 return; // changing teams is not allowed
970 // autocvar_g_balance_teams_prevent_imbalance only makes sense if autocvar_g_balance_teams is on, as it makes the team selection dialog pointless
971 if (autocvar_g_balance_teams && autocvar_g_balance_teams_prevent_imbalance)
974 if ((BIT(destination_team - 1) & FindBestTeams(this, false)) == 0)
976 Send_Notification(NOTIF_ONE, this, MSG_INFO, INFO_TEAMCHANGE_LARGERTEAM);
980 if(IS_PLAYER(this) && source_team != destination_team)
982 // reduce frags during a team change
983 TeamchangeFrags(this);
985 if (!SetPlayerTeam(this, destination_team, source_team, !IS_CLIENT(this)))
989 AutoBalanceBots(source_team, destination_team);
990 if (!IS_PLAYER(this) || (source_team == destination_team))
994 KillPlayerForTeamChange(this);
997 void AutoBalanceBots(int source_team, int destination_team)
999 if (!Team_IsValidNumber(source_team))
1001 LOG_WARNF("AutoBalanceBots: Source team is invalid: %f", source_team);
1004 if (!Team_IsValidNumber(destination_team))
1006 LOG_WARNF("AutoBalanceBots: Destination team is invalid: %f",
1010 if (!autocvar_g_balance_teams ||
1011 !autocvar_g_balance_teams_prevent_imbalance)
1015 int num_players_source_team = 0;
1016 int num_players_destination_team = 0;
1017 entity lowest_bot_destination_team = NULL;
1018 switch (source_team)
1022 num_players_source_team = c1;
1027 num_players_source_team = c2;
1032 num_players_source_team = c3;
1037 num_players_source_team = c4;
1041 if (num_players_source_team < 0)
1045 switch (destination_team)
1049 num_players_destination_team = c1;
1050 lowest_bot_destination_team = lowest_bot_team1;
1055 num_players_destination_team = c2;
1056 lowest_bot_destination_team = lowest_bot_team2;
1061 num_players_destination_team = c3;
1062 lowest_bot_destination_team = lowest_bot_team3;
1067 num_players_destination_team = c4;
1068 lowest_bot_destination_team = lowest_bot_team4;
1072 if ((num_players_destination_team <= num_players_source_team) ||
1073 (lowest_bot_destination_team == NULL))
1077 SetPlayerTeamSimple(lowest_bot_destination_team,
1078 Team_NumberToTeam(source_team));
1079 KillPlayerForTeamChange(lowest_bot_destination_team);