Add guards to stop server build fail

wsc-dfc
Elias Fleckenstein 2021-05-13 18:15:45 +02:00
parent f3e741dad1
commit 5131675a60
1 changed files with 4 additions and 0 deletions

View File

@ -361,9 +361,11 @@ void ScriptApiBase::addObjectReference(ActiveObject *cobj)
//infostream<<"scriptapi_add_object_reference: id="<<cobj->getId()<<std::endl;
// Create object on stack
#ifndef SERVER
if (m_type == ScriptingType::Client)
ClientObjectRef::create(L, dynamic_cast<ClientActiveObject *>(cobj));
else
#endif
ObjectRef::create(L, dynamic_cast<ServerActiveObject *>(cobj)); // Puts ObjectRef (as userdata) on stack
int object = lua_gettop(L);
@ -394,9 +396,11 @@ void ScriptApiBase::removeObjectReference(ActiveObject *cobj)
lua_pushnumber(L, cobj->getId()); // Push id
lua_gettable(L, objectstable);
// Set object reference to NULL
#ifndef SERVER
if (m_type == ScriptingType::Client)
ClientObjectRef::set_null(L);
else
#endif
ObjectRef::set_null(L);
lua_pop(L, 1); // pop object