From c58c26f6c0748d2e237916957463bcf92fb48008 Mon Sep 17 00:00:00 2001 From: Koncord Date: Tue, 27 Jun 2017 14:50:40 +0800 Subject: [PATCH] [Server] Implement native CreateTimer & CreateTimerEx --- apps/openmw-mp/Script/Functions/Timer.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/apps/openmw-mp/Script/Functions/Timer.cpp b/apps/openmw-mp/Script/Functions/Timer.cpp index 11c3a695e..7dd214733 100644 --- a/apps/openmw-mp/Script/Functions/Timer.cpp +++ b/apps/openmw-mp/Script/Functions/Timer.cpp @@ -13,12 +13,26 @@ using namespace mwmp; int ScriptFunctions::CreateTimer(ScriptFunc callback, int msec) noexcept { - return -1; + return mwmp::TimerAPI::CreateTimer(callback, msec, "", vector()); } int ScriptFunctions::CreateTimerEx(ScriptFunc callback, int msec, const char *types, ...) noexcept { - return -1; + try + { + vector params; + va_list args; + va_start(args, types); + GetArguments(params, args, types); + va_end(args); + + return mwmp::TimerAPI::CreateTimer(callback, msec, types, params); + } + catch (...) + { + return -1; + } + } void ScriptFunctions::StartTimer(int timerId) noexcept