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;
|
2014-05-22 17:27:13 +03:00
|
|
|
|
2014-05-30 17:50:06 +03:00
|
|
|
typedef std::vector<JsonNode> JsonVector;
|
2014-05-24 19:39:58 +03:00
|
|
|
|
2013-04-14 21:52:05 +03:00
|
|
|
/// The map generator creates a map randomly.
|
2022-09-17 13:04:01 +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;
|
|
|
|
};
|
|
|
|
|
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;
|
|
|
|
|
2014-05-22 20:25:17 +03:00
|
|
|
CRandomGenerator rand;
|
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
|
|
|
|
2015-03-01 11:20:49 +02:00
|
|
|
void findZonesForQuestArts();
|
2014-06-01 13:02:43 +03:00
|
|
|
|
|
|
|
int getNextMonlithIndex();
|
2014-07-25 11:44:17 +03:00
|
|
|
int getPrisonsRemaning() const;
|
|
|
|
void decreasePrisonsRemaining();
|
2022-08-09 07:54:32 +02:00
|
|
|
const std::vector<ArtifactID> & getQuestArtsRemaning() const;
|
2023-02-11 18:05:02 +02:00
|
|
|
void banQuestArt(const ArtifactID & id);
|
|
|
|
|
2022-08-09 07:54:32 +02:00
|
|
|
Zone * getZoneWater() const;
|
2022-05-31 11:25:39 +02:00
|
|
|
void createWaterTreasures();
|
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:
|
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;
|
2022-05-28 15:03:50 +02:00
|
|
|
|
2022-05-31 11:25:39 +02:00
|
|
|
std::vector<rmg::ZoneConnection> connectionsLeft;
|
|
|
|
|
2022-08-09 07:54:32 +02:00
|
|
|
//std::pair<Zones::key_type, Zones::mapped_type> zoneWater;
|
2014-05-30 17:50:06 +03:00
|
|
|
|
2014-07-25 11:44:17 +03:00
|
|
|
int prisonsRemaining;
|
2015-03-30 23:55:37 +02:00
|
|
|
//int questArtsRemaining;
|
2014-06-01 13:02:43 +03:00
|
|
|
int monolithIndex;
|
2015-02-28 23:37:04 +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();
|
2013-01-06 22:30:12 +03:00
|
|
|
|
2014-05-31 15:11:20 +03:00
|
|
|
};
|
2022-07-26 15:07:42 +02:00
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_END
|