From 8368a96ecebd267d92620f6f049a166e5b692c87 Mon Sep 17 00:00:00 2001 From: Martin Taibr Date: Thu, 26 Mar 2020 15:19:06 +0100 Subject: [PATCH] make sure leadlimit is >= 0 --- qcsrc/server/g_world.qc | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 2056b74ea..b0cd43455 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -1788,14 +1788,14 @@ float WinningCondition_Scores(float limit, float leadlimit) bool fraglimit_reached = (limit && WinningConditionHelper_topscore >= limit); bool leadlimit_reached = (WinningConditionHelper_topscore - WinningConditionHelper_secondscore >= leadlimit); - bool limitreached; + bool limit_reached; if(autocvar_leadlimit_and_fraglimit) - limitreached = (fraglimit_reached && leadlimit_reached); + limit_reached = (fraglimit_reached && leadlimit_reached); else - limitreached = (fraglimit_reached || leadlimit_reached); + limit_reached = (fraglimit_reached || leadlimit_reached); return GetWinningCode( - WinningConditionHelper_topscore && limitreached, + WinningConditionHelper_topscore && limit_reached, WinningConditionHelper_equality ); } @@ -1886,10 +1886,6 @@ Exit deathmatch games upon conditions */ void CheckRules_World() { - float timelimit; - float fraglimit; - float leadlimit; - VoteThink(); MapVote_Think(); @@ -1904,9 +1900,10 @@ void CheckRules_World() return; } - timelimit = autocvar_timelimit * 60; - fraglimit = autocvar_fraglimit; - leadlimit = autocvar_leadlimit; + float timelimit = autocvar_timelimit * 60; + float fraglimit = autocvar_fraglimit; + float leadlimit = autocvar_leadlimit; + if (leadlimit < 0) leadlimit = 0; if(warmup_stage || time <= game_starttime) // NOTE: this is <= to prevent problems in the very tic where the game starts { -- 2.39.2