Minor tweaks after a failed attempt at metatables

This commit is contained in:
Kayne Ruse
2014-06-23 05:58:54 +10:00
parent 316db43b0a
commit f5c58bf5ad
3 changed files with 5 additions and 2 deletions
+2 -2
View File
@@ -41,7 +41,6 @@ RoomData* RoomManager::CreateRoom(MapType mapType) {
//create the generator, use a lambda because I'm lazy
newRoom->generator = [mapType]() -> BaseGenerator* {
switch(mapType) {
case MapType::NONE: //use overworld as a default
case MapType::OVERWORLD: return new OverworldGenerator();
case MapType::RUINS: return new RuinsGenerator();
case MapType::TOWERS: return new TowersGenerator();
@@ -98,7 +97,8 @@ void RoomManager::UnloadRoom(int uid) {
RoomData* RoomManager::GetRoom(int uid) {
RoomData* ptr = FindRoom(uid);
if (ptr) return ptr;
return CreateRoom(MapType::NONE);
//TODO: proper Get() method
return nullptr;
}
RoomData* RoomManager::FindRoom(int uid) {
+2
View File
@@ -39,6 +39,8 @@ static int getRoom(lua_State* L) {
}
static int createRoom(lua_State* L) {
//TODO: check parameter count for the glue functions
//get the room manager
lua_pushstring(L, ROOM_MANAGER_PSEUDOINDEX);
lua_gettable(L, LUA_REGISTRYINDEX);