script: Put getGuiEngine() inside a client-only #ifdef

This commit is contained in:
sfan5 2020-04-26 20:57:27 +02:00 committed by Loïc Blot
parent d3f50f216f
commit 8a03097450
3 changed files with 9 additions and 2 deletions

@ -136,8 +136,10 @@ protected:
Environment* getEnv() { return m_environment; } Environment* getEnv() { return m_environment; }
void setEnv(Environment* env) { m_environment = env; } void setEnv(Environment* env) { m_environment = env; }
#ifndef SERVER
GUIEngine* getGuiEngine() { return m_guiengine; } GUIEngine* getGuiEngine() { return m_guiengine; }
void setGuiEngine(GUIEngine* guiengine) { m_guiengine = guiengine; } void setGuiEngine(GUIEngine* guiengine) { m_guiengine = guiengine; }
#endif
void objectrefGetOrCreate(lua_State *L, ServerActiveObject *cobj); void objectrefGetOrCreate(lua_State *L, ServerActiveObject *cobj);
@ -158,6 +160,8 @@ private:
IGameDef *m_gamedef = nullptr; IGameDef *m_gamedef = nullptr;
Environment *m_environment = nullptr; Environment *m_environment = nullptr;
#ifndef SERVER
GUIEngine *m_guiengine = nullptr; GUIEngine *m_guiengine = nullptr;
#endif
ScriptingType m_type; ScriptingType m_type;
}; };

@ -62,10 +62,12 @@ Environment *ModApiBase::getEnv(lua_State *L)
return getScriptApiBase(L)->getEnv(); return getScriptApiBase(L)->getEnv();
} }
#ifndef SERVER
GUIEngine *ModApiBase::getGuiEngine(lua_State *L) GUIEngine *ModApiBase::getGuiEngine(lua_State *L)
{ {
return getScriptApiBase(L)->getGuiEngine(); return getScriptApiBase(L)->getGuiEngine();
} }
#endif
std::string ModApiBase::getCurrentModPath(lua_State *L) std::string ModApiBase::getCurrentModPath(lua_State *L)
{ {

@ -32,12 +32,12 @@ extern "C" {
#ifndef SERVER #ifndef SERVER
class Client; class Client;
class GUIEngine;
#endif #endif
class ScriptApiBase; class ScriptApiBase;
class Server; class Server;
class Environment; class Environment;
class GUIEngine;
class ModApiBase : protected LuaHelper { class ModApiBase : protected LuaHelper {
@ -46,12 +46,13 @@ public:
static Server* getServer(lua_State *L); static Server* getServer(lua_State *L);
#ifndef SERVER #ifndef SERVER
static Client* getClient(lua_State *L); static Client* getClient(lua_State *L);
static GUIEngine* getGuiEngine(lua_State *L);
#endif // !SERVER #endif // !SERVER
static IGameDef* getGameDef(lua_State *L); static IGameDef* getGameDef(lua_State *L);
static Environment* getEnv(lua_State *L); static Environment* getEnv(lua_State *L);
static GUIEngine* getGuiEngine(lua_State *L);
// When we are not loading the mod, this function returns "." // When we are not loading the mod, this function returns "."
static std::string getCurrentModPath(lua_State *L); static std::string getCurrentModPath(lua_State *L);