2013-01-06 22:30:12 +03:00
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
|
2014-05-22 17:27:13 +03:00
|
|
|
#include "../GameConstants.h"
|
2013-01-06 22:30:12 +03:00
|
|
|
#include "../CRandomGenerator.h"
|
2014-05-22 20:25:17 +03:00
|
|
|
#include "CMapGenOptions.h"
|
2014-05-22 17:27:13 +03:00
|
|
|
#include "../int3.h"
|
2018-03-05 16:05:17 +02:00
|
|
|
#include "CRmgTemplate.h"
|
2022-09-17 13:04:01 +02:00
|
|
|
#include "../LoadProgress.h"
|
2013-01-06 22:30:12 +03:00
|
|
|
|
2022-07-26 15:07:42 +02:00
|
|
|
VCMI_LIB_NAMESPACE_BEGIN
|
|
|
|
|
2014-05-22 20:25:17 +03:00
|
|
|
class CRmgTemplate;
|
|
|
|
class CMapGenOptions;
|
2014-05-22 17:27:13 +03:00
|
|
|
class JsonNode;
|
2022-08-09 07:54:32 +02:00
|
|
|
class RmgMap;
|
|
|
|
class CMap;
|
|
|
|
class Zone;
|
2023-04-23 10:08:16 +02:00
|
|
|
class CZonePlacer;
|
2014-05-22 17:27:13 +03:00
|
|
|
|
2023-04-17 23:11:16 +02:00
|
|
|
using JsonVector = std::vector<JsonNode>;
|
2014-05-24 19:39:58 +03:00
|
|
|
|
2013-04-14 21:52:05 +03:00
|
|
|
/// The map generator creates a map randomly.
|
2023-05-07 07:48:12 +02:00
|
|
|
class DLL_LINKAGE CMapGenerator: public Load::Progress
|
2013-01-06 22:30:12 +03:00
|
|
|
{
|
|
|
|
public:
|
2022-06-05 08:02:58 +02:00
|
|
|
struct Config
|
|
|
|
{
|
|
|
|
std::vector<CTreasureInfo> waterTreasure;
|
|
|
|
int shipyardGuard;
|
|
|
|
int mineExtraResources;
|
|
|
|
int minGuardStrength;
|
2022-06-20 16:39:50 +02:00
|
|
|
std::string defaultRoadType;
|
2022-09-04 08:54:06 +02:00
|
|
|
std::string secondaryRoadType;
|
2022-06-05 08:02:58 +02:00
|
|
|
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;
|
2023-05-24 18:02:11 +02:00
|
|
|
bool singleThread;
|
2022-06-05 08:02:58 +02:00
|
|
|
};
|
|
|
|
|
2022-05-28 15:03:50 +02:00
|
|
|
explicit CMapGenerator(CMapGenOptions& mapGenOptions, int RandomSeed = std::time(nullptr));
|
2015-12-29 04:43:33 +02:00
|
|
|
~CMapGenerator(); // required due to std::unique_ptr
|
2022-05-28 15:03:50 +02:00
|
|
|
|
2022-06-05 08:02:58 +02:00
|
|
|
const Config & getConfig() const;
|
|
|
|
|
2022-05-28 15:03:50 +02:00
|
|
|
const CMapGenOptions& getMapGenOptions() const;
|
|
|
|
|
|
|
|
std::unique_ptr<CMap> generate();
|
2013-01-06 22:30:12 +03:00
|
|
|
|
2014-06-01 13:02:43 +03:00
|
|
|
int getNextMonlithIndex();
|
2014-07-25 11:44:17 +03:00
|
|
|
int getPrisonsRemaning() const;
|
2023-04-23 10:08:16 +02:00
|
|
|
std::shared_ptr<CZonePlacer> getZonePlacer() const;
|
2023-05-05 10:30:36 +02:00
|
|
|
const std::vector<ArtifactID> & getAllPossibleQuestArtifacts() const;
|
2023-05-06 18:54:19 +02:00
|
|
|
const std::vector<HeroTypeID> getAllPossibleHeroes() const;
|
2023-02-11 18:05:02 +02:00
|
|
|
void banQuestArt(const ArtifactID & id);
|
2023-05-05 10:30:36 +02:00
|
|
|
void banHero(const HeroTypeID& id);
|
2023-02-11 18:05:02 +02:00
|
|
|
|
2022-08-09 07:54:32 +02:00
|
|
|
Zone * getZoneWater() const;
|
2023-04-23 10:08:16 +02:00
|
|
|
void addWaterTreasuresInfo();
|
2014-05-30 17:50:06 +03:00
|
|
|
|
2022-08-09 07:54:32 +02:00
|
|
|
int getRandomSeed() const;
|
2022-05-31 11:25:39 +02:00
|
|
|
|
2013-01-06 22:30:12 +03:00
|
|
|
private:
|
2023-05-20 11:46:32 +02:00
|
|
|
CRandomGenerator rand;
|
2022-05-28 15:03:50 +02:00
|
|
|
int randomSeed;
|
|
|
|
CMapGenOptions& mapGenOptions;
|
2022-06-05 08:02:58 +02:00
|
|
|
Config config;
|
2022-08-09 07:54:32 +02:00
|
|
|
std::unique_ptr<RmgMap> map;
|
2023-04-23 10:08:16 +02:00
|
|
|
std::shared_ptr<CZonePlacer> placer;
|
2022-05-28 15:03:50 +02:00
|
|
|
|
2022-05-31 11:25:39 +02:00
|
|
|
std::vector<rmg::ZoneConnection> connectionsLeft;
|
|
|
|
|
2023-05-05 10:30:36 +02:00
|
|
|
int allowedPrisons;
|
2014-06-01 13:02:43 +03:00
|
|
|
int monolithIndex;
|
2023-05-06 18:54:19 +02:00
|
|
|
std::vector<ArtifactID> questArtifacts;
|
2014-06-01 13:02:43 +03:00
|
|
|
|
2013-04-14 22:24:31 +03:00
|
|
|
/// Generation methods
|
2022-06-05 08:02:58 +02:00
|
|
|
void loadConfig();
|
|
|
|
|
2013-04-14 22:24:31 +03:00
|
|
|
std::string getMapDescription() const;
|
2014-07-25 11:44:17 +03:00
|
|
|
|
|
|
|
void initPrisonsRemaining();
|
2015-02-28 22:14:45 +02:00
|
|
|
void initQuestArtsRemaining();
|
2013-04-14 22:24:31 +03:00
|
|
|
void addPlayerInfo();
|
|
|
|
void addHeaderInfo();
|
2014-05-22 17:27:13 +03:00
|
|
|
void genZones();
|
|
|
|
void fillZones();
|
2014-05-31 15:11:20 +03:00
|
|
|
};
|
2022-07-26 15:07:42 +02:00
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_END
|