cvar leadlimit_and_fraglimit: if set, both leadlimit and fraglimit must be reached...
authorRudolf Polzer <divverent@alientrap.org>
Fri, 2 Jul 2010 07:45:51 +0000 (09:45 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Fri, 2 Jul 2010 07:48:13 +0000 (09:48 +0200)
defaultXonotic.cfg
qcsrc/server/g_world.qc

index 950a8e116014dd3d15d42f8eec86694f7bfa999f..fbbc14f9b48593477dda4ff70ed420dbdf221054 100644 (file)
@@ -547,6 +547,7 @@ set sv_dodging_wall_distance_threshold 10 "the maximum distance from a wall that
 set sv_dodging_sound 1 "if 1 dodging makes a sound. if 0 dodging is silent"
 
 set leadlimit 0
+set leadlimit_and_fraglimit 0 "if set, leadlimit is ANDed with fraglimit (otherwise ORed)"
 
 // this means that timelimit can be overidden globally and fraglimit can be overidden for each game mode: DM/TDM, Domination, CTF, and Runematch.
 seta timelimit_override -1     "Time limit overriding the mapinfo specified one (use 0 to play without limit, and -1 to use the mapinfo's limit)"
index f873ea7c6b00331ed188b2bf1bf3f030f165fc4f..90a1e744f923a1701da7d93c1eef474c4ad5d199 100644 (file)
@@ -1740,6 +1740,8 @@ void ShuffleMaplist()
 float leaderfrags;
 float WinningCondition_Scores(float limit, float leadlimit)
 {
+       float limitreached;
+
        // TODO make everything use THIS winning condition (except LMS)
        WinningConditionHelper();
 
@@ -1784,13 +1786,22 @@ float WinningCondition_Scores(float limit, float leadlimit)
                }
        }
 
+       limitreached = FALSE;
+       if(limit)
+               if(WinningConditionHelper_topscore >= limit)
+                       limitreached = TRUE;
+       if(leadlimit)
+       {
+               float leadlimitreached;
+               leadlimitreached = (WinningConditionHelper_topscore - WinningConditionHelper_secondscore >= leadlimit);
+               if(cvar("leadlimit_and_fraglimit"))
+                       limitreached = (limitreached && leadlimitreached);
+               else
+                       limitreached = (limitreached || leadlimitreached);
+       }
+
        return GetWinningCode(
-               WinningConditionHelper_topscore &&
-               (
-                       (limit && (WinningConditionHelper_topscore >= limit))
-                       ||
-                       (leadlimit && (WinningConditionHelper_topscore - WinningConditionHelper_secondscore >= leadlimit))
-               ),
+               WinningConditionHelper_topscore && limitreached,
                WinningConditionHelper_equality
        );
 }