From: Martin Taibr Date: Sun, 22 Mar 2020 11:03:44 +0000 (+0100) Subject: simplify leadlimit_and_fraglimit X-Git-Tag: xonotic-v0.8.5~1133^2~10 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=2a6b95d44267774727ef76aca40b168939083530;p=xonotic%2Fxonotic-data.pk3dir.git simplify leadlimit_and_fraglimit --- 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,