diff --git a/apps/openmw-mp/Script/API/PublicFnAPI.cpp b/apps/openmw-mp/Script/API/PublicFnAPI.cpp index c0bc713d8..b0470b95e 100644 --- a/apps/openmw-mp/Script/API/PublicFnAPI.cpp +++ b/apps/openmw-mp/Script/API/PublicFnAPI.cpp @@ -19,11 +19,21 @@ Public::Public(ScriptFunc _public, const std::string &name, char ret_type, const publics.emplace(name, this); } +#ifdef ENABLE_LUA Public::Public(ScriptFuncLua _public, lua_State *lua, const std::string &name, char ret_type, const std::string &def) : ScriptFunction( _public, lua, ret_type, def) { publics.emplace(name, this); } +#endif + +#ifdef ENABLE_MONO +Public::Public(MonoObject *delegate, const std::string &name, char ret_type, const std::string &def) : + ScriptFunction(delegate, ret_type, def) +{ + publics.emplace(name, this); +} +#endif boost::any Public::Call(const std::string &name, const std::vector &args) { @@ -45,6 +55,15 @@ const std::string &Public::GetDefinition(const std::string &name) return it->second->def; } +Public *Public::GetPublic(const std::string &name) +{ + auto it = publics.find(name); + + if (it == publics.end()) + throw runtime_error("Public with name \"" + name + "\" does not exist"); + return it->second; +} + bool Public::IsLua(const std::string &name) { diff --git a/apps/openmw-mp/Script/API/PublicFnAPI.hpp b/apps/openmw-mp/Script/API/PublicFnAPI.hpp index 84ceb1dae..5a31d0845 100644 --- a/apps/openmw-mp/Script/API/PublicFnAPI.hpp +++ b/apps/openmw-mp/Script/API/PublicFnAPI.hpp @@ -20,6 +20,9 @@ private: #if defined(ENABLE_LUA) Public(ScriptFuncLua _public, lua_State *lua, const std::string &name, char ret_type, const std::string &def); #endif +#if defined(ENABLE_MONO) + Public(MonoObject *delegate, const std::string &name, char ret_type, const std::string &def); +#endif public: template @@ -30,6 +33,8 @@ public: static const std::string& GetDefinition(const std::string& name); + static Public * GetPublic(const std::string& name); + static bool IsLua(const std::string &name); static void DeleteAll(); diff --git a/apps/openmw-mp/Script/LangMono/LangMono.cpp b/apps/openmw-mp/Script/LangMono/LangMono.cpp index 8f1c9cede..68e7abdd2 100644 --- a/apps/openmw-mp/Script/LangMono/LangMono.cpp +++ b/apps/openmw-mp/Script/LangMono/LangMono.cpp @@ -11,6 +11,7 @@ #include #include