1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-27 22:49:25 +02:00

Place proper towns in underground (#743)

Implement feature of proper town selection in underground and surface
* Some minor refactoring of rmg
This commit is contained in:
Nordsoft91
2022-05-28 16:03:50 +03:00
committed by GitHub
parent d92356f085
commit 9d06e51631
18 changed files with 214 additions and 196 deletions

View File

@@ -52,16 +52,16 @@ class DLL_LINKAGE CMapGenerator
public:
using Zones = std::map<TRmgTemplateZoneId, std::shared_ptr<CRmgTemplateZone>>;
explicit CMapGenerator();
explicit CMapGenerator(CMapGenOptions& mapGenOptions, int RandomSeed = std::time(nullptr));
~CMapGenerator(); // required due to std::unique_ptr
std::unique_ptr<CMap> generate(CMapGenOptions * mapGenOptions, int RandomSeed = std::time(nullptr));
CMapGenOptions * mapGenOptions;
std::unique_ptr<CMap> map;
mutable std::unique_ptr<CMap> map;
CRandomGenerator rand;
int randomSeed;
CMapEditManager * editManager;
CMapEditManager* getEditManager() const;
const CMapGenOptions& getMapGenOptions() const;
std::unique_ptr<CMap> generate();
Zones & getZones();
void createDirectConnections();
@@ -69,7 +69,7 @@ public:
void findZonesForQuestArts();
void foreach_neighbour(const int3 &pos, std::function<void(int3& pos)> foo);
void foreachDirectNeighbour(const int3 &pos, std::function<void(int3& pos)> foo);
void foreachDiagonaltNeighbour(const int3& pos, std::function<void(int3& pos)> foo);
void foreachDiagonalNeighbour(const int3& pos, std::function<void(int3& pos)> foo);
bool isBlocked(const int3 &tile) const;
bool shouldBeBlocked(const int3 &tile) const;
@@ -101,6 +101,9 @@ public:
void setZoneID(const int3& tile, TRmgTemplateZoneId zid);
private:
int randomSeed;
CMapGenOptions& mapGenOptions;
std::list<rmg::ZoneConnection> connectionsLeft;
Zones zones;
std::map<TFaction, ui32> zonesPerFaction;