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;
|
2023-04-23 10:08:16 +02:00
|
|
|
class CZonePlacer;
|
2024-01-01 16:37:48 +02:00
|
|
|
class IGameCallback;
|
2014-05-22 16:27:13 +02:00
|
|
|
|
2023-04-18 00:11:16 +03:00
|
|
|
using JsonVector = std::vector<JsonNode>;
|
2014-05-24 18:39:58 +02:00
|
|
|
|
2013-04-14 18:52:05 +00: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 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;
|
2024-01-09 22:38:54 +00:00
|
|
|
std::vector<int> prisonExperience;
|
|
|
|
std::vector<int> prisonValues;
|
2022-06-05 09:02:58 +03:00
|
|
|
std::vector<int> scrollValues;
|
2024-01-09 22:38:54 +00:00
|
|
|
int pandoraMultiplierGold;
|
|
|
|
int pandoraMultiplierExperience;
|
|
|
|
int pandoraMultiplierSpells;
|
|
|
|
int pandoraSpellSchool;
|
|
|
|
int pandoraSpell60;
|
2022-06-05 09:02:58 +03:00
|
|
|
std::vector<int> pandoraCreatureValues;
|
2024-01-09 22:38:54 +00:00
|
|
|
std::vector<int> questValues;
|
|
|
|
std::vector<int> questRewardValues;
|
2023-05-24 18:02:11 +02:00
|
|
|
bool singleThread;
|
2022-06-05 09:02:58 +03:00
|
|
|
};
|
|
|
|
|
2024-01-01 16:37:48 +02:00
|
|
|
explicit CMapGenerator(CMapGenOptions& mapGenOptions, IGameCallback * cb, int RandomSeed);
|
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;
|
|
|
|
|
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
|
|
|
|
2014-06-01 12:02:43 +02:00
|
|
|
int getNextMonlithIndex();
|
2014-07-25 10:44:17 +02: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 19:05:02 +03:00
|
|
|
void banQuestArt(const ArtifactID & id);
|
2024-01-16 17:15:35 +01:00
|
|
|
void unbanQuestArt(const ArtifactID & id);
|
2022-08-09 09:54:32 +04:00
|
|
|
Zone * getZoneWater() const;
|
2023-04-23 10:08:16 +02:00
|
|
|
void addWaterTreasuresInfo();
|
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:
|
2023-05-20 11:46:32 +02:00
|
|
|
CRandomGenerator rand;
|
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;
|
2023-04-23 10:08:16 +02:00
|
|
|
std::shared_ptr<CZonePlacer> placer;
|
2022-05-28 16:03:50 +03:00
|
|
|
|
2022-05-31 12:25:39 +03:00
|
|
|
std::vector<rmg::ZoneConnection> connectionsLeft;
|
|
|
|
|
2014-06-01 12:02:43 +02:00
|
|
|
int monolithIndex;
|
2023-05-06 18:54:19 +02: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();
|
2014-05-31 16:11:20 +04:00
|
|
|
};
|
2022-07-26 16:07:42 +03:00
|
|
|
|
|
|
|
VCMI_LIB_NAMESPACE_END
|