Removed MonsterManager's Singleton status, RoomData now has mgr members

RoomData now has monsterMgr and waypointMgr members, so that it can
compare it's characters to the monster & waypoints, etc.

RoomManager has been updated. It now has a database reference, which is
passed to the monsterMgr of new rooms. The room API also has functions
which expose these managers to lua.
This commit is contained in:
Kayne Ruse
2015-01-11 19:47:42 +11:00
parent 051ed0f14c
commit d0b2f8e12f
11 changed files with 72 additions and 26 deletions
+17 -1
View File
@@ -53,6 +53,18 @@ static int getPager(lua_State* L) {
return 1;
}
static int getMonsterMgr(lua_State* L) {
RoomData* room = reinterpret_cast<RoomData*>(lua_touserdata(L, 1));
lua_pushlightuserdata(L, reinterpret_cast<void*>(room->GetMonsterMgr()) );
return 1;
}
static int getWaypointMgr(lua_State* L) {
RoomData* room = reinterpret_cast<RoomData*>(lua_touserdata(L, 1));
lua_pushlightuserdata(L, reinterpret_cast<void*>(room->GetWaypointMgr()) );
return 1;
}
static int initialize(lua_State* L) {
//set the members of the given room
RoomData* room = static_cast<RoomData*>(lua_touserdata(L, 1));
@@ -70,11 +82,15 @@ static int initialize(lua_State* L) {
}
static const luaL_Reg roomLib[] = {
{"GetPager",getPager},
{"SetName", setRoomName},
{"GetName", getRoomName},
{"SetTileset", setTilesetName},
{"GetTileset", getTilesetName},
{"GetPager",getPager},
{"GetMonsterMgr",getMonsterMgr},
{"GetWaypointMgr",getWaypointMgr},
{"Initialize", initialize},
{nullptr, nullptr}
};