diff --git a/apps/openmw-mp/Script/Functions/Timer.cpp b/apps/openmw-mp/Script/Functions/Timer.cpp index 7dd214733..bb6d01c6c 100644 --- a/apps/openmw-mp/Script/Functions/Timer.cpp +++ b/apps/openmw-mp/Script/Functions/Timer.cpp @@ -16,15 +16,12 @@ int ScriptFunctions::CreateTimer(ScriptFunc callback, int msec) noexcept return mwmp::TimerAPI::CreateTimer(callback, msec, "", vector()); } -int ScriptFunctions::CreateTimerEx(ScriptFunc callback, int msec, const char *types, ...) noexcept +int ScriptFunctions::CreateTimerEx(ScriptFunc callback, int msec, const char *types, va_list args) noexcept { 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); } diff --git a/apps/openmw-mp/Script/ScriptFunctions.cpp b/apps/openmw-mp/Script/ScriptFunctions.cpp index 83abe2bfc..5ed893b53 100644 --- a/apps/openmw-mp/Script/ScriptFunctions.cpp +++ b/apps/openmw-mp/Script/ScriptFunctions.cpp @@ -80,18 +80,14 @@ void ScriptFunctions::MakePublic(ScriptFunc _public, const char *name, char ret_ Public::MakePublic(_public, name, ret_type, def); } -boost::any ScriptFunctions::CallPublic(const char *name, ...) noexcept +boost::any ScriptFunctions::CallPublic(const char *name, va_list args) noexcept { vector params; try { string def = Public::GetDefinition(name); - - va_list args; - va_start(args, name); GetArguments(params, args, def); - va_end(args); return Public::Call(name, params); } diff --git a/apps/openmw-mp/Script/ScriptFunctions.hpp b/apps/openmw-mp/Script/ScriptFunctions.hpp index 8330be59b..0e3792fef 100644 --- a/apps/openmw-mp/Script/ScriptFunctions.hpp +++ b/apps/openmw-mp/Script/ScriptFunctions.hpp @@ -48,7 +48,7 @@ public: static void StopServer(int code) noexcept; static void MakePublic(ScriptFunc _public, const char *name, char ret_type, const char *def) noexcept; - static boost::any CallPublic(const char *name, ...) noexcept; + static boost::any CallPublic(const char *name, va_list args) noexcept; static void SendMessage(unsigned short pid, const char *message, bool broadcast) noexcept; static void CleanChatByPid(unsigned short pid); @@ -61,7 +61,7 @@ public: * \return return timer id */ static int CreateTimer(ScriptFunc callback, int msec) noexcept; - static int CreateTimerEx(ScriptFunc callback, int msec, const char *types, ...) noexcept; + static int CreateTimerEx(ScriptFunc callback, int msec, const char *types, va_list args) noexcept; static void StartTimer(int timerId) noexcept; static void StopTimer(int timerId) noexcept;