]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Removed ShufflePlayerOutOfTeam as it is never used and contains horrible bugs.
authorLyberta <lyberta@lyberta.net>
Fri, 4 Aug 2017 20:06:38 +0000 (23:06 +0300)
committerLyberta <lyberta@lyberta.net>
Fri, 4 Aug 2017 20:06:38 +0000 (23:06 +0300)
qcsrc/server/teamplay.qc
qcsrc/server/teamplay.qh

index ea3ca3825b4977e2952b3d9a96da530aad681847..9047771d76aa0e984b77793bbc9d356a25bbedc7 100644 (file)
@@ -960,145 +960,3 @@ void AutoBalanceBots(int sourceteam, int destinationteam)
                lowestbotdestinationteam, 100000, DEATH_TEAMCHANGE.m_id,
                lowestbotdestinationteam.origin, '0 0 0');
 }
-
-void ShufflePlayerOutOfTeam (float source_team)
-{
-       float smallestteam, smallestteam_count, steam;
-       float lowest_bot_score, lowest_player_score;
-       entity lowest_bot, lowest_player, selected;
-
-       smallestteam = 0;
-       smallestteam_count = 999999999;
-
-       if(c1 >= 0 && c1 < smallestteam_count)
-       {
-               smallestteam = 1;
-               smallestteam_count = c1;
-       }
-       if(c2 >= 0 && c2 < smallestteam_count)
-       {
-               smallestteam = 2;
-               smallestteam_count = c2;
-       }
-       if(c3 >= 0 && c3 < smallestteam_count)
-       {
-               smallestteam = 3;
-               smallestteam_count = c3;
-       }
-       if(c4 >= 0 && c4 < smallestteam_count)
-       {
-               smallestteam = 4;
-               smallestteam_count = c4;
-       }
-
-       if(!smallestteam)
-       {
-               bprint("warning: no smallest team\n");
-               return;
-       }
-
-       if(source_team == 1)
-               steam = NUM_TEAM_1;
-       else if(source_team == 2)
-               steam = NUM_TEAM_2;
-       else if(source_team == 3)
-               steam = NUM_TEAM_3;
-       else // if(source_team == 4)
-               steam = NUM_TEAM_4;
-
-       lowest_bot = NULL;
-       lowest_bot_score = 999999999;
-       lowest_player = NULL;
-       lowest_player_score = 999999999;
-
-       // find the lowest-scoring player & bot of that team
-       FOREACH_CLIENT(IS_PLAYER(it) && it.team == steam, LAMBDA(
-               if(it.isbot)
-               {
-                       if(it.totalfrags < lowest_bot_score)
-                       {
-                               lowest_bot = it;
-                               lowest_bot_score = it.totalfrags;
-                       }
-               }
-               else
-               {
-                       if(it.totalfrags < lowest_player_score)
-                       {
-                               lowest_player = it;
-                               lowest_player_score = it.totalfrags;
-                       }
-               }
-       ));
-
-       // prefers to move a bot...
-       if(lowest_bot != NULL)
-               selected = lowest_bot;
-       // but it will move a player if it has to
-       else
-               selected = lowest_player;
-       // don't do anything if it couldn't find anyone
-       if(!selected)
-       {
-               bprint("warning: couldn't find a player to move from team\n");
-               return;
-       }
-
-       // smallest team gains a member
-       if(smallestteam == 1)
-       {
-               c1 = c1 + 1;
-       }
-       else if(smallestteam == 2)
-       {
-               c2 = c2 + 1;
-       }
-       else if(smallestteam == 3)
-       {
-               c3 = c3 + 1;
-       }
-       else if(smallestteam == 4)
-       {
-               c4 = c4 + 1;
-       }
-       else
-       {
-               bprint("warning: destination team invalid\n");
-               return;
-       }
-       // source team loses a member
-       if(source_team == 1)
-       {
-               c1 = c1 + 1;
-       }
-       else if(source_team == 2)
-       {
-               c2 = c2 + 2;
-       }
-       else if(source_team == 3)
-       {
-               c3 = c3 + 3;
-       }
-       else if(source_team == 4)
-       {
-               c4 = c4 + 4;
-       }
-       else
-       {
-               bprint("warning: source team invalid\n");
-               return;
-       }
-
-       // move the player to the new team
-       TeamchangeFrags(selected);
-       if (!SetPlayerTeam(selected, smallestteam, source_team, false))
-       {
-               return;
-       }
-       if (IS_DEAD(selected) || MUTATOR_CALLHOOK(Player_ChangeTeamKill, selected) == true)
-       {
-               return;
-       }
-       Damage(selected, selected, selected, 100000, DEATH_AUTOTEAMCHANGE.m_id, selected.origin, '0 0 0');
-       Send_Notification(NOTIF_ONE, selected, MSG_CENTER, CENTER_DEATH_SELF_AUTOTEAMCHANGE, selected.team);
-}
index 9cfcc3d9ef5958d05faf7b3d80b221e23b602e96..b19b8c0daad4e0cd1991d7a469d81fe94de625de 100644 (file)
@@ -112,6 +112,4 @@ int JoinBestTeam(entity this, bool only_return_best, bool forcebestteam);
 /// been called.
 void AutoBalanceBots(int sourceteam, int destinationteam);
 
-void ShufflePlayerOutOfTeam (float source_team);
-
 void setcolor(entity this, int clr);