1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-14 10:12:59 +02:00
vcmi/lib/rmg/CMapGenerator.h

108 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-09-17 13:04:01 +02:00
#include "../LoadProgress.h"
VCMI_LIB_NAMESPACE_BEGIN
class CRmgTemplate;
class CMapGenOptions;
class JsonNode;
class RmgMap;
class CMap;
class Zone;
class CZonePlacer;
2024-01-01 16:37:48 +02:00
class IGameCallback;
2023-04-17 23:11:16 +02:00
using JsonVector = std::vector<JsonNode>;
/// The map generator creates a map randomly.
2023-05-07 07:48:12 +02:00
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;
std::vector<int> prisonValues;
std::vector<int> scrollValues;
int pandoraMultiplierGold;
int pandoraMultiplierExperience;
int pandoraMultiplierSpells;
int pandoraSpellSchool;
int pandoraSpell60;
std::vector<int> pandoraCreatureValues;
std::vector<int> questValues;
std::vector<int> questRewardValues;
bool singleThread;
};
2024-01-01 16:37:48 +02:00
explicit CMapGenerator(CMapGenOptions& mapGenOptions, IGameCallback * cb, int RandomSeed);
~CMapGenerator(); // required due to std::unique_ptr
const Config & getConfig() const;
const CMapGenOptions& getMapGenOptions() const;
std::unique_ptr<CMap> generate();
int getNextMonlithIndex();
int getPrisonsRemaining() const;
std::shared_ptr<CZonePlacer> getZonePlacer() const;
const std::vector<ArtifactID> & getAllPossibleQuestArtifacts() const;
const std::vector<HeroTypeID> getAllPossibleHeroes() const;
2023-02-11 18:05:02 +02:00
void banQuestArt(const ArtifactID & id);
void unbanQuestArt(const ArtifactID & id);
Zone * getZoneWater() const;
void addWaterTreasuresInfo();
int getRandomSeed() const;
private:
2023-05-20 11:46:32 +02:00
CRandomGenerator rand;
int randomSeed;
CMapGenOptions& mapGenOptions;
Config config;
std::unique_ptr<RmgMap> map;
std::shared_ptr<CZonePlacer> placer;
std::vector<rmg::ZoneConnection> connectionsLeft;
int monolithIndex;
std::vector<ArtifactID> questArtifacts;
/// Generation methods
void loadConfig();
std::string getMapDescription() const;
void initPrisonsRemaining();
void initQuestArtsRemaining();
void addPlayerInfo();
void addHeaderInfo();
void genZones();
void fillZones();
};
VCMI_LIB_NAMESPACE_END