diff --git a/apps/openmw-mp/Script/API/TimerAPI.cpp b/apps/openmw-mp/Script/API/TimerAPI.cpp index 7489497d9..e4275d927 100644 --- a/apps/openmw-mp/Script/API/TimerAPI.cpp +++ b/apps/openmw-mp/Script/API/TimerAPI.cpp @@ -1,7 +1,3 @@ -// -// Created by koncord on 15.03.16. -// - #include "TimerAPI.hpp" #include @@ -14,7 +10,7 @@ Timer::Timer(ScriptFunc callback, long msec, const std::string& def, std::vector { targetMsec = msec; this->args = args; - end = true; + isEnded = true; } #if defined(ENABLE_LUA) @@ -22,13 +18,13 @@ Timer::Timer(lua_State *lua, ScriptFuncLua callback, long msec, const std::strin { targetMsec = msec; this->args = args; - end = true; + isEnded = true; } #endif void Timer::Tick() { - if (end) + if (isEnded) return; const auto duration = chrono::system_clock::now().time_since_epoch(); @@ -36,19 +32,19 @@ void Timer::Tick() if (time - startTime >= targetMsec) { - end = true; + isEnded = true; Call(args); } } -bool Timer::IsEnd() +bool Timer::IsEnded() { - return end; + return isEnded; } void Timer::Stop() { - end = true; + isEnded = true; } void Timer::Restart(int msec) @@ -59,7 +55,7 @@ void Timer::Restart(int msec) void Timer::Start() { - end = false; + isEnded = false; const auto duration = chrono::system_clock::now().time_since_epoch(); const auto msec = chrono::duration_cast(duration).count(); @@ -172,12 +168,12 @@ void TimerAPI::StopTimer(int timerid) } } -bool TimerAPI::IsEndTimer(int timerid) +bool TimerAPI::IsTimerElapsed(int timerid) { bool ret = false; try { - ret = timers.at(timerid)->IsEnd(); + ret = timers.at(timerid)->IsEnded(); } catch(...) { diff --git a/apps/openmw-mp/Script/API/TimerAPI.hpp b/apps/openmw-mp/Script/API/TimerAPI.hpp index b20be12d6..83b6baba4 100644 --- a/apps/openmw-mp/Script/API/TimerAPI.hpp +++ b/apps/openmw-mp/Script/API/TimerAPI.hpp @@ -1,7 +1,3 @@ -// -// Created by koncord on 15.03.16. -// - #ifndef OPENMW_TIMERAPI_HPP #define OPENMW_TIMERAPI_HPP @@ -27,7 +23,7 @@ namespace mwmp #endif void Tick(); - bool IsEnd(); + bool IsEnded(); void Stop(); void Start(); void Restart(int msec); @@ -36,7 +32,7 @@ namespace mwmp std::string publ, arg_types; std::vector args; Script *scr; - bool end; + bool isEnded; }; class TimerAPI @@ -50,7 +46,7 @@ namespace mwmp static void ResetTimer(int timerid, long msec); static void StartTimer(int timerid); static void StopTimer(int timerid); - static bool IsEndTimer(int timerid); + static bool IsTimerElapsed(int timerid); static void Terminate(); diff --git a/apps/openmw-mp/Script/Functions/Timer.cpp b/apps/openmw-mp/Script/Functions/Timer.cpp index bb6d01c6c..2ec0e131a 100644 --- a/apps/openmw-mp/Script/Functions/Timer.cpp +++ b/apps/openmw-mp/Script/Functions/Timer.cpp @@ -54,5 +54,5 @@ void ScriptFunctions::FreeTimer(int timerId) noexcept bool ScriptFunctions::IsTimerElapsed(int timerId) noexcept { - return TimerAPI::IsEndTimer(timerId); + return TimerAPI::IsTimerElapsed(timerId); }