Skip to content

Commit

Permalink
script: Put getGuiEngine() inside a client-only #ifdef
Browse files Browse the repository at this point in the history
  • Loading branch information
sfan5 authored and nerzhul committed Apr 27, 2020
1 parent d3f50f2 commit 8a03097
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/script/cpp_api/s_base.h
Expand Up @@ -136,8 +136,10 @@ class ScriptApiBase : protected LuaHelper {
Environment* getEnv() { return m_environment; }
void setEnv(Environment* env) { m_environment = env; }

#ifndef SERVER
GUIEngine* getGuiEngine() { return m_guiengine; }
void setGuiEngine(GUIEngine* guiengine) { m_guiengine = guiengine; }
#endif

void objectrefGetOrCreate(lua_State *L, ServerActiveObject *cobj);

Expand All @@ -158,6 +160,8 @@ class ScriptApiBase : protected LuaHelper {

IGameDef *m_gamedef = nullptr;
Environment *m_environment = nullptr;
#ifndef SERVER
GUIEngine *m_guiengine = nullptr;
#endif
ScriptingType m_type;
};
2 changes: 2 additions & 0 deletions src/script/lua_api/l_base.cpp
Expand Up @@ -62,10 +62,12 @@ Environment *ModApiBase::getEnv(lua_State *L)
return getScriptApiBase(L)->getEnv();
}

#ifndef SERVER
GUIEngine *ModApiBase::getGuiEngine(lua_State *L)
{
return getScriptApiBase(L)->getGuiEngine();
}
#endif

std::string ModApiBase::getCurrentModPath(lua_State *L)
{
Expand Down
5 changes: 3 additions & 2 deletions src/script/lua_api/l_base.h
Expand Up @@ -32,12 +32,12 @@ extern "C" {

#ifndef SERVER
class Client;
class GUIEngine;
#endif

class ScriptApiBase;
class Server;
class Environment;
class GUIEngine;

class ModApiBase : protected LuaHelper {

Expand All @@ -46,12 +46,13 @@ class ModApiBase : protected LuaHelper {
static Server* getServer(lua_State *L);
#ifndef SERVER
static Client* getClient(lua_State *L);
static GUIEngine* getGuiEngine(lua_State *L);
#endif // !SERVER

static IGameDef* getGameDef(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 "."
static std::string getCurrentModPath(lua_State *L);

Expand Down

0 comments on commit 8a03097

Please sign in to comment.