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 "../CObjectHandler.h"
|
|
|
|
#include "../int3.h"
|
2013-01-06 22:30:12 +03:00
|
|
|
|
|
|
|
class CMap;
|
2014-05-22 20:25:17 +03:00
|
|
|
class CRmgTemplate;
|
|
|
|
class CRmgTemplateZone;
|
|
|
|
class CMapGenOptions;
|
2014-05-22 17:27:13 +03:00
|
|
|
class CTerrainViewPatternConfig;
|
2013-01-06 22:30:12 +03:00
|
|
|
class CMapEditManager;
|
2014-05-22 17:27:13 +03:00
|
|
|
class JsonNode;
|
|
|
|
|
|
|
|
typedef std::vector<JsonNode> JsonVector;
|
|
|
|
|
|
|
|
class CMapGenerator;
|
|
|
|
|
2013-04-14 21:52:05 +03:00
|
|
|
/// The map generator creates a map randomly.
|
|
|
|
class DLL_LINKAGE CMapGenerator
|
2013-01-06 22:30:12 +03:00
|
|
|
{
|
|
|
|
public:
|
2014-05-23 12:56:51 +03:00
|
|
|
explicit CMapGenerator(shared_ptr<CMapGenOptions> mapGenOptions, int randomSeed = std::time(nullptr));
|
2013-04-14 22:24:31 +03:00
|
|
|
~CMapGenerator(); // required due to unique_ptr
|
2013-01-06 22:30:12 +03:00
|
|
|
|
2014-05-22 20:25:17 +03:00
|
|
|
ConstTransitivePtr<CMap> generate();
|
2014-05-22 17:27:13 +03:00
|
|
|
|
2014-05-23 12:56:51 +03:00
|
|
|
shared_ptr<CMapGenOptions> mapGenOptions;
|
2014-05-22 20:25:17 +03:00
|
|
|
ConstTransitivePtr<CMap> map;
|
|
|
|
CRandomGenerator rand;
|
2014-05-22 17:27:13 +03:00
|
|
|
int randomSeed;
|
|
|
|
CMapEditManager * editManager;
|
2013-01-06 22:30:12 +03:00
|
|
|
|
|
|
|
private:
|
2014-05-22 20:25:17 +03:00
|
|
|
std::map<TRmgTemplateZoneId, CRmgTemplateZone*> zones;
|
2014-05-22 17:27:13 +03:00
|
|
|
|
2013-04-14 22:24:31 +03:00
|
|
|
/// Generation methods
|
|
|
|
std::string getMapDescription() const;
|
|
|
|
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-22 17:27:13 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
/* ---------------------------------------------------------------------------- */
|
|
|
|
/* Implementation/Detail classes, Private API */
|
|
|
|
/* ---------------------------------------------------------------------------- */
|
|
|
|
|