From 6eea65fac7318ab7763c79ab97f92288f98fdb9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= <5415177+ZehMatt@users.noreply.github.com> Date: Thu, 11 Jan 2024 19:45:07 +0200 Subject: [PATCH] Make the compiler happy --- src/openrct2/scripting/ScriptEngine.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/openrct2/scripting/ScriptEngine.cpp b/src/openrct2/scripting/ScriptEngine.cpp index 10e8a7bd97..3d05f5f162 100644 --- a/src/openrct2/scripting/ScriptEngine.cpp +++ b/src/openrct2/scripting/ScriptEngine.cpp @@ -1597,10 +1597,12 @@ void ScriptEngine::SetParkStorageFromJSON(std::string_view value) IntervalHandle ScriptEngine::AllocateHandle() { - // In case of overflow start from 1 again - _nextIntervalHandle = std::max(_nextIntervalHandle++, 1U); + const auto nextHandle = _nextIntervalHandle; - return _nextIntervalHandle; + // In case of overflow start from 1 again + _nextIntervalHandle = std::max(_nextIntervalHandle + 1U, 1U); + + return nextHandle; } IntervalHandle ScriptEngine::AddInterval(const std::shared_ptr& plugin, int32_t delay, bool repeat, DukValue&& callback)