From 5a8f57c6ca9ee3238938ed9f2de67e6a14679f03 Mon Sep 17 00:00:00 2001 From: justn <39979049+jvstns@users.noreply.github.com> Date: Tue, 20 Aug 2024 00:28:49 -0400 Subject: [PATCH 1/3] Fixes negative numbers Fixes negative remaining duration in current timer, remaining should always be 0 --- Shared/mods/deathmatch/logic/lua/CLuaTimer.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Shared/mods/deathmatch/logic/lua/CLuaTimer.cpp b/Shared/mods/deathmatch/logic/lua/CLuaTimer.cpp index 00f919704f0..c2302b08121 100644 --- a/Shared/mods/deathmatch/logic/lua/CLuaTimer.cpp +++ b/Shared/mods/deathmatch/logic/lua/CLuaTimer.cpp @@ -68,5 +68,9 @@ CTickCount CLuaTimer::GetTimeLeft() { CTickCount llCurrentTime = CTickCount::Now(); CTickCount llTimeLeft = m_llStartTime + m_llDelay - llCurrentTime; + + if (llTimeLeft.ToLongLong() < 0) + return CTickCount(0LL); + return llTimeLeft; } From 73dbb50de600c85f7ddf133676e26642599640cc Mon Sep 17 00:00:00 2001 From: justn <39979049+jvstns@users.noreply.github.com> Date: Tue, 20 Aug 2024 18:16:52 -0400 Subject: [PATCH 2/3] Return in single statement Co-authored-by: Nico <122193236+Nico8340@users.noreply.github.com> --- Shared/mods/deathmatch/logic/lua/CLuaTimer.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Shared/mods/deathmatch/logic/lua/CLuaTimer.cpp b/Shared/mods/deathmatch/logic/lua/CLuaTimer.cpp index c2302b08121..f939dafe4e9 100644 --- a/Shared/mods/deathmatch/logic/lua/CLuaTimer.cpp +++ b/Shared/mods/deathmatch/logic/lua/CLuaTimer.cpp @@ -68,9 +68,5 @@ CTickCount CLuaTimer::GetTimeLeft() { CTickCount llCurrentTime = CTickCount::Now(); CTickCount llTimeLeft = m_llStartTime + m_llDelay - llCurrentTime; - - if (llTimeLeft.ToLongLong() < 0) - return CTickCount(0LL); - - return llTimeLeft; + return llTimeLeft.ToLongLong() < 0 ? CTickCount(0LL) : llTimeLeft; } From b23d9c92ade48962a0e5e3210e5f747d8b20ed51 Mon Sep 17 00:00:00 2001 From: justn <39979049+jvstns@users.noreply.github.com> Date: Thu, 22 Aug 2024 15:01:40 -0400 Subject: [PATCH 3/3] 0 > 0LL --- Shared/mods/deathmatch/logic/lua/CLuaTimer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Shared/mods/deathmatch/logic/lua/CLuaTimer.cpp b/Shared/mods/deathmatch/logic/lua/CLuaTimer.cpp index f939dafe4e9..f632a1a237f 100644 --- a/Shared/mods/deathmatch/logic/lua/CLuaTimer.cpp +++ b/Shared/mods/deathmatch/logic/lua/CLuaTimer.cpp @@ -68,5 +68,5 @@ CTickCount CLuaTimer::GetTimeLeft() { CTickCount llCurrentTime = CTickCount::Now(); CTickCount llTimeLeft = m_llStartTime + m_llDelay - llCurrentTime; - return llTimeLeft.ToLongLong() < 0 ? CTickCount(0LL) : llTimeLeft; + return llTimeLeft.ToLongLong() < 0LL ? CTickCount(0LL) : llTimeLeft; }