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