diff --git a/src/saland/GameRegion.cpp b/src/saland/GameRegion.cpp index 92c0d1d..efb3ac4 100644 --- a/src/saland/GameRegion.cpp +++ b/src/saland/GameRegion.cpp @@ -115,6 +115,13 @@ void GameRegion::SpawnItem(const ItemDef& def, float destX, float destY) { } } +std::string GameRegion::GetRegionType(int region_x, int region_y) const { + if (region_x == -1 && region_y == 0) { + return "forrest"; + } + return "default"; +} + void GameRegion::Init(int x, int y, const std::string& worldName, bool forceResetWorld) { region_x = x; region_y = y; @@ -122,7 +129,7 @@ void GameRegion::Init(int x, int y, const std::string& worldName, bool forceRese std::string loadMap = mapFileName; if (!sago::FileExists(loadMap.c_str()) || forceResetWorld) { loadMap = "maps/sample1.tmx"; - if (region_x == -1 && region_y == 0) { + if (GetRegionType(region_x, region_y) == "forrest") { loadMap = "maps/template_forrest.tmx"; } if (region_x == 0 && region_y == -2) { @@ -168,7 +175,7 @@ void GameRegion::Init(int x, int y, const std::string& worldName, bool forceRese //Forrest region - if (region_x == -1 && region_y == 0) { + if (GetRegionType(region_x, region_y) == "forrest") { std::cout << "Forrest region\n"; for (int i=0; i<10; ++i) { diff --git a/src/saland/GameRegion.hpp b/src/saland/GameRegion.hpp index 1099c40..5b793ae 100644 --- a/src/saland/GameRegion.hpp +++ b/src/saland/GameRegion.hpp @@ -57,6 +57,7 @@ public: } void SpawnMonster(const MonsterDef& def, float destX, float destY) ; void SpawnItem(const ItemDef& def, float destX, float destY) ; + std::string GetRegionType(int x, int y) const; private: int region_x = 0; int region_y = 0;