Don't announce frags remaining if leadlimit_and_fraglimit 1 and fraglimit 0 and leadl...
authorterencehill <piuntn@gmail.com>
Sun, 22 Mar 2020 12:03:04 +0000 (13:03 +0100)
committerterencehill <piuntn@gmail.com>
Sun, 22 Mar 2020 12:03:04 +0000 (13:03 +0100)
Basically I've just added 'if (limit)' before 'fragsleft = max(leadingfragsleft, fragsleft);', other changes are just code rearrangement.
Also removed 'if (fragsleft > 3) fragsleft = 0;' as it was just an negligible optimization

qcsrc/server/g_world.qc

index 89fee90..fd8631f 100644 (file)
@@ -1751,28 +1751,24 @@ float WinningCondition_Scores(float limit, float leadlimit)
                        leaderscore = WinningConditionHelper_topscore;
                        secondscore = WinningConditionHelper_secondscore;
 
+                       if (limit)
+                               fragsleft = limit - leaderscore;
                        if (leadlimit)
                                leadingfragsleft = secondscore + leadlimit - leaderscore;
-                       if (autocvar_leadlimit_and_fraglimit && leadlimit && limit)
+
+                       if (autocvar_leadlimit_and_fraglimit && leadlimit)
                        {
-                               fragsleft = limit - leaderscore;
-                               fragsleft = max(leadingfragsleft, fragsleft);
+                               if (limit)
+                                       fragsleft = max(leadingfragsleft, fragsleft);
                        }
-                       else
+                       else if (leadlimit)
                        {
                                if (limit)
-                               {
-                                       fragsleft = limit - leaderscore;
-                                       if (leadlimit)
-                                               fragsleft = min(fragsleft, leadingfragsleft);
-                               }
-                               else if (leadlimit)
+                                       fragsleft = min(fragsleft, leadingfragsleft);
+                               else
                                        fragsleft = leadingfragsleft;
                        }
 
-                       if (fragsleft > 3)
-                               fragsleft = 0;
-
                        if (fragsleft_last != fragsleft) // do not announce same remaining frags multiple times
                        {
                                if (fragsleft == 1)