]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Cleanse teamplay.qc of the looping horrors
authorMario <mario@smbclan.net>
Thu, 24 Dec 2015 04:14:04 +0000 (14:14 +1000)
committerMario <mario@smbclan.net>
Thu, 24 Dec 2015 04:14:04 +0000 (14:14 +1000)
qcsrc/server/teamplay.qc

index 1cd11b6854cc574277eed9b3a01014d274232267..71f3bf48a796dfb136d8e7bc89197fdb49a46a69 100644 (file)
@@ -669,7 +669,7 @@ void ShufflePlayerOutOfTeam (float source_team)
 {
        float smallestteam, smallestteam_count, steam;
        float lowest_bot_score, lowest_player_score;
-       entity head, lowest_bot, lowest_player, selected;
+       entity lowest_bot, lowest_player, selected;
 
        smallestteam = 0;
        smallestteam_count = 999999999;
@@ -716,28 +716,24 @@ void ShufflePlayerOutOfTeam (float source_team)
        lowest_player_score = 999999999;
 
        // find the lowest-scoring player & bot of that team
-       FOR_EACH_PLAYER(head)
-       {
-               if(head.team == steam)
+       FOREACH_CLIENT(IS_PLAYER(it) && it.team == steam, LAMBDA(
+               if(it.isbot)
                {
-                       if(head.isbot)
+                       if(it.totalfrags < lowest_bot_score)
                        {
-                               if(head.totalfrags < lowest_bot_score)
-                               {
-                                       lowest_bot = head;
-                                       lowest_bot_score = head.totalfrags;
-                               }
+                               lowest_bot = it;
+                               lowest_bot_score = it.totalfrags;
                        }
-                       else
+               }
+               else
+               {
+                       if(it.totalfrags < lowest_player_score)
                        {
-                               if(head.totalfrags < lowest_player_score)
-                               {
-                                       lowest_player = head;
-                                       lowest_player_score = head.totalfrags;
-                               }
+                               lowest_player = it;
+                               lowest_player_score = it.totalfrags;
                        }
                }
-       }
+       ));
 
        // prefers to move a bot...
        if(lowest_bot != world)