diff --git a/apps/openmw-mp/Script/Functions/Timer.cpp b/apps/openmw-mp/Script/Functions/Timer.cpp index f2246c2c9..7a3b5eaea 100644 --- a/apps/openmw-mp/Script/Functions/Timer.cpp +++ b/apps/openmw-mp/Script/Functions/Timer.cpp @@ -13,12 +13,12 @@ using namespace mwmp; int ScriptFunctions::CreateTimer(ScriptFunc callback, int msec) noexcept { - + return -1; } int ScriptFunctions::CreateTimerEx(ScriptFunc callback, int msec, const char *types, ...) noexcept { - + return -1; } void ScriptFunctions::StartTimer(int timerId) noexcept @@ -43,7 +43,7 @@ void ScriptFunctions::FreeTimer(int timerId) noexcept bool ScriptFunctions::IsTimerElapsed(int timerId) noexcept { - TimerAPI::IsEndTimer(timerId); + return TimerAPI::IsEndTimer(timerId); } diff --git a/apps/openmw-mp/Script/LangLua/LangLua.cpp b/apps/openmw-mp/Script/LangLua/LangLua.cpp index 47c77c265..44b0dc543 100644 --- a/apps/openmw-mp/Script/LangLua/LangLua.cpp +++ b/apps/openmw-mp/Script/LangLua/LangLua.cpp @@ -108,7 +108,7 @@ void LangLua::LoadProgram(const char *filename) luabridge::Namespace tes3mp = luabridge::getGlobalNamespace(lua).beginNamespace("tes3mp"); - for(int i = 0; i < functions_n; i++) + for(unsigned i = 0; i < functions_n; i++) tes3mp.addCFunction(functions_[i].name, functions_[i].func); tes3mp.endNamespace(); @@ -121,6 +121,7 @@ void LangLua::LoadProgram(const char *filename) int LangLua::FreeProgram() { lua_close(lua); + return 0; } bool LangLua::IsCallbackPresent(const char *name) @@ -135,7 +136,7 @@ boost::any LangLua::Call(const char *name, const char *argl, int buf, ...) std::vector args; try { - unsigned int len = strlen(argl); + size_t len = strlen(argl); for (unsigned int i = 0; i < len; ++i) { diff --git a/apps/openmw-mp/Script/LangLua/LangLua.hpp b/apps/openmw-mp/Script/LangLua/LangLua.hpp index de390d15a..66bb41a9a 100644 --- a/apps/openmw-mp/Script/LangLua/LangLua.hpp +++ b/apps/openmw-mp/Script/LangLua/LangLua.hpp @@ -40,10 +40,10 @@ public: LangLua(lua_State *lua); ~LangLua(); static int MakePublic(lua_State *lua) noexcept; - static int CallPublic(lua_State *lua) noexcept; + static int CallPublic(lua_State *lua); static int CreateTimer(lua_State *lua) noexcept; - static int CreateTimerEx(lua_State *lua) noexcept; + static int CreateTimerEx(lua_State *lua); virtual void LoadProgram(const char *filename) override; virtual int FreeProgram() override; diff --git a/apps/openmw-mp/Script/LangLua/LuaFunc.cpp b/apps/openmw-mp/Script/LangLua/LuaFunc.cpp index 230838376..628ffe40e 100644 --- a/apps/openmw-mp/Script/LangLua/LuaFunc.cpp +++ b/apps/openmw-mp/Script/LangLua/LuaFunc.cpp @@ -76,7 +76,7 @@ int LangLua::MakePublic(lua_State *lua) noexcept } -int LangLua::CallPublic(lua_State *lua) noexcept +int LangLua::CallPublic(lua_State *lua) { const char * name = luabridge::Stack::get(lua, 1); @@ -84,7 +84,7 @@ int LangLua::CallPublic(lua_State *lua) noexcept string types = Public::GetDefinition(name); - if(args_n != types.size()) + if(args_n != (long)types.size()) throw invalid_argument("Script call: Number of arguments does not match definition"); vector args = DefToVec(lua, types, 2, args_n); @@ -115,7 +115,7 @@ int LangLua::CreateTimer(lua_State *lua) noexcept return 1; } -int LangLua::CreateTimerEx(lua_State *lua) noexcept +int LangLua::CreateTimerEx(lua_State *lua) { const char * callback = luabridge::Stack::get(lua, 1); int msec = luabridge::Stack::get(lua, 2); diff --git a/apps/openmw-mp/Script/Language.hpp b/apps/openmw-mp/Script/Language.hpp index 76872e834..5e7690667 100644 --- a/apps/openmw-mp/Script/Language.hpp +++ b/apps/openmw-mp/Script/Language.hpp @@ -13,6 +13,7 @@ class Language { public: + virtual ~Language(){} virtual void LoadProgram(const char* filename) = 0; virtual int FreeProgram() = 0; virtual bool IsCallbackPresent(const char* name) = 0; diff --git a/apps/openmw-mp/Script/ScriptFunction.hpp b/apps/openmw-mp/Script/ScriptFunction.hpp index 42e5ca60e..1af1c4c77 100644 --- a/apps/openmw-mp/Script/ScriptFunction.hpp +++ b/apps/openmw-mp/Script/ScriptFunction.hpp @@ -47,8 +47,8 @@ protected: }; protected: - std::string def; char ret_type; + std::string def; int script_type; enum { diff --git a/apps/openmw-mp/Script/ScriptFunctions.cpp b/apps/openmw-mp/Script/ScriptFunctions.cpp index 9edd643c6..da3301db3 100644 --- a/apps/openmw-mp/Script/ScriptFunctions.cpp +++ b/apps/openmw-mp/Script/ScriptFunctions.cpp @@ -80,6 +80,7 @@ void ScriptFunctions::GetArguments(std::vector ¶ms, va_list args va_end(args); throw; } + va_end(args); } void ScriptFunctions::MakePublic(ScriptFunc _public, const char *name, char ret_type, const char *def) noexcept diff --git a/apps/openmw-mp/Utils.cpp b/apps/openmw-mp/Utils.cpp index b02dc7ba0..25bf5bd53 100644 --- a/apps/openmw-mp/Utils.cpp +++ b/apps/openmw-mp/Utils.cpp @@ -57,7 +57,7 @@ string Utils::str_replace(const string& source, const char* find, const char* re { unsigned int find_len = strlen(find); unsigned int replace_len = strlen(replace); - long pos = 0; + size_t pos = 0; string dest = source; @@ -72,7 +72,7 @@ string Utils::str_replace(const string& source, const char* find, const char* re string& Utils::RemoveExtension(string& file) { - unsigned int pos = file.find_last_of('.'); + size_t pos = file.find_last_of('.'); if (pos) file = file.substr(0, pos); @@ -80,7 +80,7 @@ string& Utils::RemoveExtension(string& file) return file; } -unsigned int Utils::FileLength(const char* file) +long int Utils::FileLength(const char* file) { FILE* _file = fopen(file, "rb"); @@ -88,7 +88,7 @@ unsigned int Utils::FileLength(const char* file) return 0; fseek(_file, 0, SEEK_END); - unsigned int size = ftell(_file); + long int size = ftell(_file); fclose(_file); return size; diff --git a/apps/openmw-mp/Utils.hpp b/apps/openmw-mp/Utils.hpp index d8b22b6de..59ba04ee2 100644 --- a/apps/openmw-mp/Utils.hpp +++ b/apps/openmw-mp/Utils.hpp @@ -38,7 +38,7 @@ namespace Utils std::string &RemoveExtension(std::string &file); - unsigned int FileLength(const char *file); + long int FileLength(const char *file); unsigned int crc32buf(char *buf, size_t len);