1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-22 22:13:35 +02:00
vcmi/lib/rmg/CMapGenerator.h

104 lines
2.5 KiB
C
Raw Normal View History

/*
* CMapGenerator.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
#pragma once
#include "../GameConstants.h"
#include "../CRandomGenerator.h"
#include "CMapGenOptions.h"
#include "../int3.h"
#include "CRmgTemplate.h"
2022-08-30 23:24:12 +02:00
#include "../LoadProgress.h"
class CRmgTemplate;
class CMapGenOptions;
class JsonNode;
class RmgMap;
class CMap;
class Zone;
typedef std::vector<JsonNode> JsonVector;
/// The map generator creates a map randomly.
2022-08-30 23:24:12 +02:00
class DLL_LINKAGE CMapGenerator: public Load::Progress
{
public:
struct Config
{
std::vector<Terrain> terrainUndergroundAllowed;
std::vector<Terrain> terrainGroundProhibit;
std::vector<CTreasureInfo> waterTreasure;
int shipyardGuard;
int mineExtraResources;
int minGuardStrength;
std::string defaultRoadType;
int treasureValueLimit;
std::vector<int> prisonExperience, prisonValues;
std::vector<int> scrollValues;
int pandoraMultiplierGold, pandoraMultiplierExperience, pandoraMultiplierSpells, pandoraSpellSchool, pandoraSpell60;
std::vector<int> pandoraCreatureValues;
std::vector<int> questValues, questRewardValues;
};
explicit CMapGenerator(CMapGenOptions& mapGenOptions, int RandomSeed = std::time(nullptr));
~CMapGenerator(); // required due to std::unique_ptr
const Config & getConfig() const;
CRandomGenerator rand;
const CMapGenOptions& getMapGenOptions() const;
2022-08-30 15:08:33 +02:00
std::unique_ptr<CMap> generate(bool emptyMap = false);
void disableModificator(const std::string & modificator);
2015-03-01 11:20:49 +02:00
void findZonesForQuestArts();
int getNextMonlithIndex();
int getPrisonsRemaning() const;
void decreasePrisonsRemaining();
const std::vector<ArtifactID> & getQuestArtsRemaning() const;
2015-02-28 23:37:04 +02:00
void banQuestArt(ArtifactID id);
Zone * getZoneWater() const;
void createWaterTreasures();
int getRandomSeed() const;
private:
int randomSeed;
CMapGenOptions& mapGenOptions;
Config config;
std::unique_ptr<RmgMap> map;
std::set<std::string> disabledModificators;
std::vector<rmg::ZoneConnection> connectionsLeft;
//std::pair<Zones::key_type, Zones::mapped_type> zoneWater;
int prisonsRemaining;
2015-03-30 23:55:37 +02:00
//int questArtsRemaining;
int monolithIndex;
2015-02-28 23:37:04 +02:00
std::vector<ArtifactID> questArtifacts;
/// Generation methods
void loadConfig();
std::string getMapDescription() const;
void initPrisonsRemaining();
void initQuestArtsRemaining();
void addPlayerInfo();
void addHeaderInfo();
void genZones();
void fillZones();
};