From 2a6b95d44267774727ef76aca40b168939083530 Mon Sep 17 00:00:00 2001 From: Martin Taibr Date: Sun, 22 Mar 2020 12:03:44 +0100 Subject: [PATCH] simplify leadlimit_and_fraglimit --- qcsrc/server/g_world.qc | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 8ec26efd6..2056b74ea 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -1710,8 +1710,6 @@ float secondscore; int fragsleft_last; float WinningCondition_Scores(float limit, float leadlimit) { - float limitreached; - // TODO make everything use THIS winning condition (except LMS) WinningConditionHelper(NULL); @@ -1787,18 +1785,14 @@ float WinningCondition_Scores(float limit, float leadlimit) } } - limitreached = false; - if (limit && WinningConditionHelper_topscore >= limit) - limitreached = true; - if(leadlimit) - { - float leadlimitreached; - leadlimitreached = (WinningConditionHelper_topscore - WinningConditionHelper_secondscore >= leadlimit); - if(autocvar_leadlimit_and_fraglimit) - limitreached = (limitreached && leadlimitreached); - else - limitreached = (limitreached || leadlimitreached); - } + bool fraglimit_reached = (limit && WinningConditionHelper_topscore >= limit); + bool leadlimit_reached = (WinningConditionHelper_topscore - WinningConditionHelper_secondscore >= leadlimit); + + bool limitreached; + if(autocvar_leadlimit_and_fraglimit) + limitreached = (fraglimit_reached && leadlimit_reached); + else + limitreached = (fraglimit_reached || leadlimit_reached); return GetWinningCode( WinningConditionHelper_topscore && limitreached, -- 2.39.2