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"); // TODO: somehow get this into the mutator
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 strcpy(cache_lastmutatormsg, autocvar_g_mutatormsg);
135 strcpy(cache_mutatormsg, cache_lastmutatormsg);
138 if (cache_mutatormsg != "") {
139 s = strcat(s, "\n\n^8special gameplay tips: ^7", cache_mutatormsg);
142 string mutator_msg = "";
143 MUTATOR_CALLHOOK(BuildGameplayTipsString, mutator_msg);
144 mutator_msg = M_ARGV(0, string);
146 s = strcat(s, mutator_msg); // trust that the mutator will do proper formatting
148 string motd = autocvar_sv_motd;
150 s = strcat(s, "\n\n^8MOTD: ^7", strreplace("\\n", "\n", motd));
155 void setcolor(entity this, int clr)
158 this.clientcolors = clr;
159 this.team = (clr & 15) + 1;
161 builtin_setcolor(this, clr);
165 void SetPlayerColors(entity player, float _color)
167 float pants = _color & 0x0F;
168 float shirt = _color & 0xF0;
171 setcolor(player, 16 * pants + pants);
175 setcolor(player, shirt + pants);
179 void KillPlayerForTeamChange(entity player)
185 if (MUTATOR_CALLHOOK(Player_ChangeTeamKill, player) == true)
189 Damage(player, player, player, 100000, DEATH_TEAMCHANGE.m_id, DMG_NOWEP, player.origin,
193 bool SetPlayerTeamSimple(entity player, int team_num)
195 if (player.team == team_num)
197 // This is important when players join the game and one of their color
198 // matches the team color while other doesn't. For example [BOT]Lion.
199 SetPlayerColors(player, team_num - 1);
202 if (MUTATOR_CALLHOOK(Player_ChangeTeam, player, Team_TeamToNumber(
203 player.team), Team_TeamToNumber(team_num)) == true)
205 // Mutator has blocked team change.
208 int old_team = player.team;
209 SetPlayerColors(player, team_num - 1);
210 MUTATOR_CALLHOOK(Player_ChangedTeam, player, old_team, player.team);
214 bool SetPlayerTeam(entity player, int destination_team, int source_team,
217 int team_num = Team_NumberToTeam(destination_team);
218 if (!SetPlayerTeamSimple(player, team_num))
222 LogTeamchange(player.playerid, player.team, 3); // log manual team join
227 bprint(playername(player, false), "^7 has changed from ", Team_NumberToColoredFullName(source_team), "^7 to ", Team_NumberToColoredFullName(destination_team), "\n");
231 // set c1...c4 to show what teams are allowed
232 void CheckAllowedTeams(entity for_whom)
236 c1 = c2 = c3 = c4 = -1;
237 num_bots_team1 = num_bots_team2 = num_bots_team3 = num_bots_team4 = 0;
239 string teament_name = string_null;
241 bool mutator_returnvalue = MUTATOR_CALLHOOK(CheckAllowedTeams, teams_mask, teament_name, for_whom);
242 teams_mask = M_ARGV(0, float);
243 teament_name = M_ARGV(1, string);
245 if(!mutator_returnvalue)
247 if(teams_mask & BIT(0)) c1 = 0;
248 if(teams_mask & BIT(1)) c2 = 0;
249 if(teams_mask & BIT(2)) c3 = 0;
250 if(teams_mask & BIT(3)) c4 = 0;
253 // find out what teams are allowed if necessary
256 entity head = find(NULL, classname, teament_name);
261 case NUM_TEAM_1: c1 = 0; break;
262 case NUM_TEAM_2: c2 = 0; break;
263 case NUM_TEAM_3: c3 = 0; break;
264 case NUM_TEAM_4: c4 = 0; break;
267 head = find(head, classname, teament_name);
271 // TODO: Balance quantity of bots across > 2 teams when bot_vs_human is set (and remove next line)
272 if(AvailableTeams() == 2)
273 if(autocvar_bot_vs_human && for_whom)
275 if(autocvar_bot_vs_human > 0)
277 // find last team available
279 if(IS_BOT_CLIENT(for_whom))
281 if(c4 >= 0) { c3 = c2 = c1 = -1; }
282 else if(c3 >= 0) { c4 = c2 = c1 = -1; }
283 else { c4 = c3 = c1 = -1; }
284 // no further cases, we know at least 2 teams exist
288 if(c1 >= 0) { c2 = c3 = c4 = -1; }
289 else if(c2 >= 0) { c1 = c3 = c4 = -1; }
290 else { c1 = c2 = c4 = -1; }
291 // no further cases, bots have one of the teams
296 // find first team available
298 if(IS_BOT_CLIENT(for_whom))
300 if(c1 >= 0) { c2 = c3 = c4 = -1; }
301 else if(c2 >= 0) { c1 = c3 = c4 = -1; }
302 else { c1 = c2 = c4 = -1; }
303 // no further cases, we know at least 2 teams exist
307 if(c4 >= 0) { c3 = c2 = c1 = -1; }
308 else if(c3 >= 0) { c4 = c2 = c1 = -1; }
309 else { c4 = c3 = c1 = -1; }
310 // no further cases, bots have one of the teams
318 // if player has a forced team, ONLY allow that one
319 if(for_whom.team_forced == NUM_TEAM_1 && c1 >= 0)
321 else if(for_whom.team_forced == NUM_TEAM_2 && c2 >= 0)
323 else if(for_whom.team_forced == NUM_TEAM_3 && c3 >= 0)
325 else if(for_whom.team_forced == NUM_TEAM_4 && c4 >= 0)
329 float PlayerValue(entity p)
332 // FIXME: it always returns 1...
335 // c1...c4 should be set to -1 (not allowed) or 0 (allowed).
336 // teams that are allowed will now have their player counts stored in c1...c4
337 void GetTeamCounts(entity ignore)
339 if (MUTATOR_CALLHOOK(GetTeamCounts) == true)
343 MUTATOR_CALLHOOK(GetTeamCount, NUM_TEAM_1, ignore, c1,
344 num_bots_team1, lowest_human_team1, lowest_bot_team1);
345 c1 = M_ARGV(2, float);
346 num_bots_team1 = M_ARGV(3, float);
347 lowest_human_team1 = M_ARGV(4, entity);
348 lowest_bot_team1 = M_ARGV(5, entity);
352 MUTATOR_CALLHOOK(GetTeamCount, NUM_TEAM_2, ignore, c2,
353 num_bots_team2, lowest_human_team2, lowest_bot_team2);
354 c2 = M_ARGV(2, float);
355 num_bots_team2 = M_ARGV(3, float);
356 lowest_human_team2 = M_ARGV(4, entity);
357 lowest_bot_team2 = M_ARGV(5, entity);
361 MUTATOR_CALLHOOK(GetTeamCount, NUM_TEAM_3, ignore, c3,
362 num_bots_team3, lowest_human_team3, lowest_bot_team3);
363 c3 = M_ARGV(2, float);
364 num_bots_team3 = M_ARGV(3, float);
365 lowest_human_team3 = M_ARGV(4, entity);
366 lowest_bot_team3 = M_ARGV(5, entity);
370 MUTATOR_CALLHOOK(GetTeamCount, NUM_TEAM_4, ignore,
371 c4, num_bots_team4, lowest_human_team4, lowest_bot_team4);
372 c4 = M_ARGV(2, float);
373 num_bots_team4 = M_ARGV(3, float);
374 lowest_human_team4 = M_ARGV(4, entity);
375 lowest_bot_team4 = M_ARGV(5, entity);
381 // now count how many players are on each team already
382 float lowest_human_score1 = FLOAT_MAX;
383 float lowest_bot_score1 = FLOAT_MAX;
384 float lowest_human_score2 = FLOAT_MAX;
385 float lowest_bot_score2 = FLOAT_MAX;
386 float lowest_human_score3 = FLOAT_MAX;
387 float lowest_bot_score3 = FLOAT_MAX;
388 float lowest_human_score4 = FLOAT_MAX;
389 float lowest_bot_score4 = FLOAT_MAX;
393 if (IS_PLAYER(it) || it.caplayer)
397 else if (it.team_forced > 0)
399 t = it.team_forced; // reserve the spot
409 value = PlayerValue(it);
410 if (IS_BOT_CLIENT(it))
431 num_bots_team1 += bvalue;
432 float temp_score = PlayerScore_Get(it, SP_SCORE);
435 if (temp_score < lowest_human_score1)
437 lowest_human_team1 = it;
438 lowest_human_score1 = temp_score;
442 if (temp_score < lowest_bot_score1)
444 lowest_bot_team1 = it;
445 lowest_bot_score1 = temp_score;
456 num_bots_team2 += bvalue;
457 float temp_score = PlayerScore_Get(it, SP_SCORE);
460 if (temp_score < lowest_human_score2)
462 lowest_human_team2 = it;
463 lowest_human_score2 = temp_score;
467 if (temp_score < lowest_bot_score2)
469 lowest_bot_team2 = it;
470 lowest_bot_score2 = temp_score;
481 num_bots_team3 += bvalue;
482 float temp_score = PlayerScore_Get(it, SP_SCORE);
485 if (temp_score < lowest_human_score3)
487 lowest_human_team3 = it;
488 lowest_human_score3 = temp_score;
492 if (temp_score < lowest_bot_score3)
494 lowest_bot_team3 = it;
495 lowest_bot_score3 = temp_score;
506 num_bots_team4 += bvalue;
507 float temp_score = PlayerScore_Get(it, SP_SCORE);
510 if (temp_score < lowest_human_score4)
512 lowest_human_team4 = it;
513 lowest_human_score4 = temp_score;
517 if (temp_score < lowest_bot_score4)
519 lowest_bot_team4 = it;
520 lowest_bot_score4 = temp_score;
528 // if the player who has a forced team has not joined yet, reserve the spot
529 if(autocvar_g_campaign)
531 switch(autocvar_g_campaign_forceteam)
533 case 1: if(c1 == num_bots_team1) ++c1; break;
534 case 2: if(c2 == num_bots_team2) ++c2; break;
535 case 3: if(c3 == num_bots_team3) ++c3; break;
536 case 4: if(c4 == num_bots_team4) ++c4; break;
541 bool IsTeamSmallerThanTeam(int team_a, int team_b, entity player,
544 if (!Team_IsValidNumber(team_a))
546 LOG_FATALF("IsTeamSmallerThanTeam: team_a is invalid: %f", team_a);
548 if (!Team_IsValidNumber(team_b))
550 LOG_FATALF("IsTeamSmallerThanTeam: team_b is invalid: %f", team_b);
552 if (team_a == team_b)
556 // we assume that CheckAllowedTeams and GetTeamCounts have already been called
557 int num_players_team_a = -1, num_players_team_b = -1;
558 int num_bots_team_a = 0, num_bots_team_b = 0;
559 float score_team_a = 0, score_team_b = 0;
564 num_players_team_a = c1;
565 num_bots_team_a = num_bots_team1;
566 score_team_a = team1_score;
571 num_players_team_a = c2;
572 num_bots_team_a = num_bots_team2;
573 score_team_a = team2_score;
578 num_players_team_a = c3;
579 num_bots_team_a = num_bots_team3;
580 score_team_a = team3_score;
585 num_players_team_a = c4;
586 num_bots_team_a = num_bots_team4;
587 score_team_a = team4_score;
595 num_players_team_b = c1;
596 num_bots_team_b = num_bots_team1;
597 score_team_b = team1_score;
602 num_players_team_b = c2;
603 num_bots_team_b = num_bots_team2;
604 score_team_b = team2_score;
609 num_players_team_b = c3;
610 num_bots_team_b = num_bots_team3;
611 score_team_b = team3_score;
616 num_players_team_b = c4;
617 num_bots_team_b = num_bots_team4;
618 score_team_b = team4_score;
623 if (num_players_team_a < 0 || num_players_team_b < 0)
627 if (IS_REAL_CLIENT(player) && bots_would_leave)
629 num_players_team_a -= num_bots_team_a;
630 num_players_team_b -= num_bots_team_b;
634 return num_players_team_a < num_players_team_b;
636 if (num_players_team_a < num_players_team_b)
640 if (num_players_team_a > num_players_team_b)
644 return score_team_a < score_team_b;
647 bool IsTeamEqualToTeam(int team_a, int team_b, entity player, bool use_score)
649 if (!Team_IsValidNumber(team_a))
651 LOG_FATALF("IsTeamEqualToTeam: team_a is invalid: %f", team_a);
653 if (!Team_IsValidNumber(team_b))
655 LOG_FATALF("IsTeamEqualToTeam: team_b is invalid: %f", team_b);
657 if (team_a == team_b)
661 // we assume that CheckAllowedTeams and GetTeamCounts have already been called
662 int num_players_team_a = -1, num_players_team_b = -1;
663 int num_bots_team_a = 0, num_bots_team_b = 0;
664 float score_team_a = 0, score_team_b = 0;
669 num_players_team_a = c1;
670 num_bots_team_a = num_bots_team1;
671 score_team_a = team1_score;
676 num_players_team_a = c2;
677 num_bots_team_a = num_bots_team2;
678 score_team_a = team2_score;
683 num_players_team_a = c3;
684 num_bots_team_a = num_bots_team3;
685 score_team_a = team3_score;
690 num_players_team_a = c4;
691 num_bots_team_a = num_bots_team4;
692 score_team_a = team4_score;
700 num_players_team_b = c1;
701 num_bots_team_b = num_bots_team1;
702 score_team_b = team1_score;
707 num_players_team_b = c2;
708 num_bots_team_b = num_bots_team2;
709 score_team_b = team2_score;
714 num_players_team_b = c3;
715 num_bots_team_b = num_bots_team3;
716 score_team_b = team3_score;
721 num_players_team_b = c4;
722 num_bots_team_b = num_bots_team4;
723 score_team_b = team4_score;
728 if (num_players_team_a < 0 || num_players_team_b < 0)
731 if (IS_REAL_CLIENT(player) && bots_would_leave)
733 num_players_team_a -= num_bots_team_a;
734 num_players_team_b -= num_bots_team_b;
738 return num_players_team_a == num_players_team_b;
740 if (num_players_team_a != num_players_team_b)
744 return score_team_a == score_team_b;
747 int FindBestTeams(entity player, bool use_score)
749 if (MUTATOR_CALLHOOK(FindBestTeams, player) == true)
751 return M_ARGV(1, float);
754 int previous_team = 0;
762 if (previous_team == 0)
767 else if (IsTeamSmallerThanTeam(2, previous_team, player, use_score))
772 else if (IsTeamEqualToTeam(2, previous_team, player, use_score))
780 if (previous_team == 0)
785 else if (IsTeamSmallerThanTeam(3, previous_team, player, use_score))
790 else if (IsTeamEqualToTeam(3, previous_team, player, use_score))
798 if (previous_team == 0)
802 else if (IsTeamSmallerThanTeam(4, previous_team, player, use_score))
806 else if (IsTeamEqualToTeam(4, previous_team, player, use_score))
814 // returns # of smallest team (1, 2, 3, 4)
815 // NOTE: Assumes CheckAllowedTeams has already been called!
816 int FindSmallestTeam(entity player, float ignore_player)
818 // count how many players are in each team
821 GetTeamCounts(player);
827 int team_bits = FindBestTeams(player, true);
830 error(sprintf("No teams available for %s\n", MapInfo_Type_ToString(MapInfo_CurrentGametype())));
832 RandomSelection_Init();
833 if ((team_bits & BIT(0)) != 0)
835 RandomSelection_AddFloat(1, 1, 1);
837 if ((team_bits & BIT(1)) != 0)
839 RandomSelection_AddFloat(2, 1, 1);
841 if ((team_bits & BIT(2)) != 0)
843 RandomSelection_AddFloat(3, 1, 1);
845 if ((team_bits & BIT(3)) != 0)
847 RandomSelection_AddFloat(4, 1, 1);
849 return RandomSelection_chosen_float;
852 void JoinBestTeam(entity this, bool force_best_team)
854 // don't join a team if we're not playing a team game
860 // find out what teams are available
861 CheckAllowedTeams(this);
863 // if we don't care what team they end up on, put them on whatever team they entered as.
864 // if they're not on a valid team, then let other code put them on the smallest team
865 if (!force_best_team)
868 if ((c1 >= 0) && (this.team == NUM_TEAM_1))
870 selected_team = this.team;
872 else if ((c2 >= 0) && (this.team == NUM_TEAM_2))
874 selected_team = this.team;
876 else if ((c3 >= 0) && (this.team == NUM_TEAM_3))
878 selected_team = this.team;
880 else if ((c4 >= 0) && (this.team == NUM_TEAM_4))
882 selected_team = this.team;
889 if (selected_team > 0)
891 SetPlayerTeamSimple(this, selected_team);
892 LogTeamchange(this.playerid, this.team, 99);
896 // otherwise end up on the smallest team (handled below)
897 if (this.bot_forced_team)
901 int best_team = FindSmallestTeam(this, true);
902 best_team = Team_NumberToTeam(best_team);
905 error("JoinBestTeam: invalid team\n");
907 int old_team = Team_TeamToNumber(this.team);
908 TeamchangeFrags(this);
909 SetPlayerTeamSimple(this, best_team);
910 LogTeamchange(this.playerid, this.team, 2); // log auto join
911 if ((old_team != -1) && !IS_BOT_CLIENT(this))
913 AutoBalanceBots(old_team, Team_TeamToNumber(best_team));
915 KillPlayerForTeamChange(this);
918 void SV_ChangeTeam(entity this, float _color)
920 float source_color, destination_color, source_team, destination_team;
922 // in normal deathmatch we can just apply the color and we're done
924 SetPlayerColors(this, _color);
928 // since this is an engine function, and gamecode doesn't have any calls earlier than this, do the connecting message here
929 Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_CONNECTING, this.netname);
936 source_color = this.clientcolors & 0x0F;
937 destination_color = _color & 0x0F;
939 source_team = Team_TeamToNumber(source_color + 1);
940 destination_team = Team_TeamToNumber(destination_color + 1);
942 if (destination_team == -1)
947 CheckAllowedTeams(this);
949 if (destination_team == 1 && c1 < 0) destination_team = 4;
950 if (destination_team == 4 && c4 < 0) destination_team = 3;
951 if (destination_team == 3 && c3 < 0) destination_team = 2;
952 if (destination_team == 2 && c2 < 0) destination_team = 1;
954 // not changing teams
955 if (source_color == destination_color)
957 SetPlayerTeam(this, destination_team, source_team, true);
961 if((autocvar_g_campaign) || (autocvar_g_changeteam_banned && CS(this).wasplayer)) {
962 Send_Notification(NOTIF_ONE, this, MSG_INFO, INFO_TEAMCHANGE_NOTALLOWED);
963 return; // changing teams is not allowed
966 // autocvar_g_balance_teams_prevent_imbalance only makes sense if autocvar_g_balance_teams is on, as it makes the team selection dialog pointless
967 if (autocvar_g_balance_teams && autocvar_g_balance_teams_prevent_imbalance)
970 if ((BIT(destination_team - 1) & FindBestTeams(this, false)) == 0)
972 Send_Notification(NOTIF_ONE, this, MSG_INFO, INFO_TEAMCHANGE_LARGERTEAM);
976 if(IS_PLAYER(this) && source_team != destination_team)
978 // reduce frags during a team change
979 TeamchangeFrags(this);
981 if (!SetPlayerTeam(this, destination_team, source_team, !IS_CLIENT(this)))
985 AutoBalanceBots(source_team, destination_team);
986 if (!IS_PLAYER(this) || (source_team == destination_team))
990 KillPlayerForTeamChange(this);
993 void AutoBalanceBots(int source_team, int destination_team)
995 if (!Team_IsValidNumber(source_team))
997 LOG_WARNF("AutoBalanceBots: Source team is invalid: %f", source_team);
1000 if (!Team_IsValidNumber(destination_team))
1002 LOG_WARNF("AutoBalanceBots: Destination team is invalid: %f",
1006 if (!autocvar_g_balance_teams ||
1007 !autocvar_g_balance_teams_prevent_imbalance)
1011 int num_players_source_team = 0;
1012 int num_players_destination_team = 0;
1013 entity lowest_bot_destination_team = NULL;
1014 switch (source_team)
1018 num_players_source_team = c1;
1023 num_players_source_team = c2;
1028 num_players_source_team = c3;
1033 num_players_source_team = c4;
1037 if (num_players_source_team < 0)
1041 switch (destination_team)
1045 num_players_destination_team = c1;
1046 lowest_bot_destination_team = lowest_bot_team1;
1051 num_players_destination_team = c2;
1052 lowest_bot_destination_team = lowest_bot_team2;
1057 num_players_destination_team = c3;
1058 lowest_bot_destination_team = lowest_bot_team3;
1063 num_players_destination_team = c4;
1064 lowest_bot_destination_team = lowest_bot_team4;
1068 if ((num_players_destination_team <= num_players_source_team) ||
1069 (lowest_bot_destination_team == NULL))
1073 SetPlayerTeamSimple(lowest_bot_destination_team,
1074 Team_NumberToTeam(source_team));
1075 KillPlayerForTeamChange(lowest_bot_destination_team);