diff --git a/common/map/region_pager_lua.cpp b/common/map/region_pager_lua.cpp index 368f950..e74c59a 100644 --- a/common/map/region_pager_lua.cpp +++ b/common/map/region_pager_lua.cpp @@ -21,6 +21,7 @@ */ #include "region_pager_lua.hpp" +#include "region_api.hpp" #include "utility.hpp" #include @@ -32,7 +33,7 @@ Region* RegionPagerLua::LoadRegion(int x, int y) { Region tmpRegion(x, y); //API hook - lua_getglobal(lua, "Region"); + lua_getglobal(lua, TORTUGA_REGION_NAME); lua_getfield(lua, -1, "Load"); lua_pushlightuserdata(lua, &tmpRegion); if (lua_pcall(lua, 1, 1, 0) != LUA_OK) { @@ -53,7 +54,7 @@ Region* RegionPagerLua::SaveRegion(int x, int y) { Region* ptr = FindRegion(x, y); if (ptr) { //API hook - lua_getglobal(lua, "Region"); + lua_getglobal(lua, TORTUGA_REGION_NAME); lua_getfield(lua, -1, "Save"); lua_pushlightuserdata(lua, ptr); if (lua_pcall(lua, 1, 0, 0) != LUA_OK) { @@ -73,7 +74,7 @@ Region* RegionPagerLua::CreateRegion(int x, int y) { Region tmpRegion(x, y); //API hook - lua_getglobal(lua, "Region"); + lua_getglobal(lua, TORTUGA_REGION_NAME); lua_getfield(lua, -1, "Create"); lua_pushlightuserdata(lua, &tmpRegion); //TODO: parameters @@ -86,7 +87,7 @@ Region* RegionPagerLua::CreateRegion(int x, int y) { } void RegionPagerLua::UnloadRegion(int x, int y) { - lua_getglobal(lua, "Region"); + lua_getglobal(lua, TORTUGA_REGION_NAME); regionList.remove_if([&](Region& region) -> bool { if (region.GetX() == x && region.GetY() == y) { @@ -107,7 +108,7 @@ void RegionPagerLua::UnloadRegion(int x, int y) { } void RegionPagerLua::UnloadAll() { - lua_getglobal(lua, "Region"); + lua_getglobal(lua, TORTUGA_REGION_NAME); for (auto& it : regionList) { //API hook diff --git a/rsc/scripts/setup_server.lua b/rsc/scripts/setup_server.lua index ce07f88..fa47442 100644 --- a/rsc/scripts/setup_server.lua +++ b/rsc/scripts/setup_server.lua @@ -34,7 +34,7 @@ end --Get some regions --BUG: The server fails without this -newRoom = RoomMgr.CreateRoom("overworld") +newRoom = RoomManager.CreateRoom() pager = Room.GetPager(newRoom) regionTable = { RegionPager.GetRegion(pager, Region.GetWidth() * 0, Region.GetHeight() * 0),