1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00
vcmi/lib/rmg/CMapGenerator.h
Tomasz Zieliński d137f7157c Merge remote-tracking branch 'origin/develop' into parellel_rmg
# Conflicts:
#	lib/rmg/CZonePlacer.h
#	lib/rmg/TreasurePlacer.h
2023-05-05 09:00:44 +02:00

106 lines
2.5 KiB
C++

/*
* 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"
#include "../LoadProgress.h"
VCMI_LIB_NAMESPACE_BEGIN
class CRmgTemplate;
class CMapGenOptions;
class JsonNode;
class RmgMap;
class CMap;
class Zone;
class CZonePlacer;
using JsonVector = std::vector<JsonNode>;
/// The map generator creates a map randomly.
class DLL_LINKAGE CMapGenerator: public Load::Progress
{
public:
struct Config
{
std::vector<CTreasureInfo> waterTreasure;
int shipyardGuard;
int mineExtraResources;
int minGuardStrength;
std::string defaultRoadType;
std::string secondaryRoadType;
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;
std::unique_ptr<CMap> generate();
int getNextMonlithIndex();
int getPrisonsRemaning() const;
std::shared_ptr<CZonePlacer> getZonePlacer() const;
void decreasePrisonsRemaining();
const std::vector<ArtifactID> & getQuestArtsRemaning() const;
void banQuestArt(const ArtifactID & id);
Zone * getZoneWater() const;
void addWaterTreasuresInfo();
int getRandomSeed() const;
private:
int randomSeed;
CMapGenOptions& mapGenOptions;
Config config;
std::unique_ptr<RmgMap> map;
std::shared_ptr<CZonePlacer> placer;
std::vector<rmg::ZoneConnection> connectionsLeft;
//std::pair<Zones::key_type, Zones::mapped_type> zoneWater;
int prisonsRemaining;
//int questArtsRemaining;
int monolithIndex;
std::vector<ArtifactID> questArtifacts; //TODO: Protect with mutex
/// Generation methods
void loadConfig();
std::string getMapDescription() const;
void initPrisonsRemaining();
void initQuestArtsRemaining();
void addPlayerInfo();
void addHeaderInfo();
void genZones();
void fillZones();
};
VCMI_LIB_NAMESPACE_END