Committing the island generator script, and a bugfix

region_api.cpp had a bug, where a glue function's name was used twice. It
was an easy catch, but there was an issue in the new script, where I was
counting from 0 instead of 1. As a result, I was chasing a segfault for 5
hours.
This commit is contained in:
Kayne Ruse
2014-06-23 10:29:39 +10:00
parent f5c58bf5ad
commit 95362286f8
5 changed files with 53 additions and 9 deletions
+3 -2
View File
@@ -41,6 +41,8 @@ RoomData* RoomManager::CreateRoom(MapType mapType) {
//create the generator, use a lambda because I'm lazy
newRoom->generator = [mapType]() -> BaseGenerator* {
switch(mapType) {
//BUG: Not having a map type results in an overworld generator by default
case MapType::NONE:
case MapType::OVERWORLD: return new OverworldGenerator();
case MapType::RUINS: return new RuinsGenerator();
case MapType::TOWERS: return new TowersGenerator();
@@ -97,8 +99,7 @@ void RoomManager::UnloadRoom(int uid) {
RoomData* RoomManager::GetRoom(int uid) {
RoomData* ptr = FindRoom(uid);
if (ptr) return ptr;
//TODO: proper Get() method
return nullptr;
return CreateRoom(MapType::NONE);
}
RoomData* RoomManager::FindRoom(int uid) {