mirror of
https://github.com/minetest/minetest.git
synced 2024-11-30 03:23:45 +01:00
Revert "Clean up some getServer() unsafety"
Turned out to not be a good idea. This reverts commit 58eccc7a2a67405744ef4a8d7be29f264021d826.
This commit is contained in:
parent
73dbd2f0ab
commit
df4c9e2903
@ -541,8 +541,8 @@ Server* ScriptApiBase::getServer()
|
|||||||
{
|
{
|
||||||
// Since the gamedef is the server it's still possible to retrieve it in
|
// Since the gamedef is the server it's still possible to retrieve it in
|
||||||
// e.g. the async environment, but this isn't meant to happen.
|
// e.g. the async environment, but this isn't meant to happen.
|
||||||
if (getType() != ScriptingType::Server)
|
// TODO: still needs work
|
||||||
return nullptr;
|
//assert(getType() == ScriptingType::Server);
|
||||||
return dynamic_cast<Server *>(m_gamedef);
|
return dynamic_cast<Server *>(m_gamedef);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,15 +56,10 @@ EmergeScripting::EmergeScripting(EmergeThread *parent):
|
|||||||
|
|
||||||
InitializeModApi(L, top);
|
InitializeModApi(L, top);
|
||||||
|
|
||||||
// pull the globals data from the server
|
auto *data = ModApiBase::getServer(L)->m_lua_globals_data.get();
|
||||||
{
|
assert(data);
|
||||||
auto *server = dynamic_cast<Server*>(ModApiBase::getGameDef(L));
|
script_unpack(L, data);
|
||||||
assert(server);
|
lua_setfield(L, top, "transferred_globals");
|
||||||
auto *data = server->m_lua_globals_data.get();
|
|
||||||
assert(data);
|
|
||||||
script_unpack(L, data);
|
|
||||||
lua_setfield(L, top, "transferred_globals");
|
|
||||||
}
|
|
||||||
|
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
|
|
||||||
|
@ -192,10 +192,8 @@ void ServerScripting::InitializeAsync(lua_State *L, int top)
|
|||||||
LuaVoxelManip::Register(L);
|
LuaVoxelManip::Register(L);
|
||||||
LuaSettings::Register(L);
|
LuaSettings::Register(L);
|
||||||
|
|
||||||
// pull the globals data from the server
|
// globals data
|
||||||
auto *server = dynamic_cast<Server*>(ModApiBase::getGameDef(L));
|
auto *data = ModApiBase::getServer(L)->m_lua_globals_data.get();
|
||||||
assert(server);
|
|
||||||
auto *data = server->m_lua_globals_data.get();
|
|
||||||
assert(data);
|
assert(data);
|
||||||
script_unpack(L, data);
|
script_unpack(L, data);
|
||||||
lua_setfield(L, top, "transferred_globals");
|
lua_setfield(L, top, "transferred_globals");
|
||||||
|
Loading…
Reference in New Issue
Block a user