Minor tweaks after a failed attempt at metatables
This commit is contained in:
@@ -41,7 +41,6 @@ RoomData* RoomManager::CreateRoom(MapType mapType) {
|
|||||||
//create the generator, use a lambda because I'm lazy
|
//create the generator, use a lambda because I'm lazy
|
||||||
newRoom->generator = [mapType]() -> BaseGenerator* {
|
newRoom->generator = [mapType]() -> BaseGenerator* {
|
||||||
switch(mapType) {
|
switch(mapType) {
|
||||||
case MapType::NONE: //use overworld as a default
|
|
||||||
case MapType::OVERWORLD: return new OverworldGenerator();
|
case MapType::OVERWORLD: return new OverworldGenerator();
|
||||||
case MapType::RUINS: return new RuinsGenerator();
|
case MapType::RUINS: return new RuinsGenerator();
|
||||||
case MapType::TOWERS: return new TowersGenerator();
|
case MapType::TOWERS: return new TowersGenerator();
|
||||||
@@ -98,7 +97,8 @@ void RoomManager::UnloadRoom(int uid) {
|
|||||||
RoomData* RoomManager::GetRoom(int uid) {
|
RoomData* RoomManager::GetRoom(int uid) {
|
||||||
RoomData* ptr = FindRoom(uid);
|
RoomData* ptr = FindRoom(uid);
|
||||||
if (ptr) return ptr;
|
if (ptr) return ptr;
|
||||||
return CreateRoom(MapType::NONE);
|
//TODO: proper Get() method
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
RoomData* RoomManager::FindRoom(int uid) {
|
RoomData* RoomManager::FindRoom(int uid) {
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ static int getRoom(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int createRoom(lua_State* L) {
|
static int createRoom(lua_State* L) {
|
||||||
|
//TODO: check parameter count for the glue functions
|
||||||
|
|
||||||
//get the room manager
|
//get the room manager
|
||||||
lua_pushstring(L, ROOM_MANAGER_PSEUDOINDEX);
|
lua_pushstring(L, ROOM_MANAGER_PSEUDOINDEX);
|
||||||
lua_gettable(L, LUA_REGISTRYINDEX);
|
lua_gettable(L, LUA_REGISTRYINDEX);
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
TODO: encapsulate the data structures
|
TODO: encapsulate the data structures
|
||||||
TODO: Get the rooms working
|
TODO: Get the rooms working
|
||||||
|
|
||||||
|
TODO: make the whole thing more fault tolerant
|
||||||
TODO: Authentication
|
TODO: Authentication
|
||||||
TODO: server is slaved to the client
|
TODO: server is slaved to the client
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user