From 5fd0fa537582090adc9a9be29ecbbb5f2fa82835 Mon Sep 17 00:00:00 2001 From: Lyberta Date: Fri, 4 Aug 2017 23:06:38 +0300 Subject: [PATCH] Removed ShufflePlayerOutOfTeam as it is never used and contains horrible bugs. --- qcsrc/server/teamplay.qc | 142 --------------------------------------- qcsrc/server/teamplay.qh | 2 - 2 files changed, 144 deletions(-) diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index ea3ca3825..9047771d7 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -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); -} diff --git a/qcsrc/server/teamplay.qh b/qcsrc/server/teamplay.qh index 9cfcc3d9e..b19b8c0da 100644 --- a/qcsrc/server/teamplay.qh +++ b/qcsrc/server/teamplay.qh @@ -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); -- 2.39.2