mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-26 22:57:00 +02:00
fe1b16a7ec
- refactored CRandomGenerator (added util methods, improved method names) - usages of std::minstd_ran are replaced by CRandomGenerator (not in entire code base, C rand() usages are still not replaced) - refactored getArtSync method of CArtHandler -> now named pickRandomArtifact - fixed some compiler warnings - updated source code URL in VCMI spec
43 lines
897 B
C++
43 lines
897 B
C++
|
|
/*
|
|
* 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
|
|
|
|
#include "../CRandomGenerator.h"
|
|
#include "CMapGenOptions.h"
|
|
|
|
class CMap;
|
|
class CMapEditManager;
|
|
|
|
/// The map generator creates a map randomly.
|
|
class DLL_LINKAGE CMapGenerator
|
|
{
|
|
public:
|
|
CMapGenerator();
|
|
~CMapGenerator(); // required due to unique_ptr
|
|
|
|
std::unique_ptr<CMap> generate(CMapGenOptions * mapGenOptions, int randomSeed = std::time(nullptr));
|
|
|
|
private:
|
|
/// Generation methods
|
|
std::string getMapDescription() const;
|
|
void addPlayerInfo();
|
|
void addHeaderInfo();
|
|
void genTerrain();
|
|
void genTowns();
|
|
|
|
CMapGenOptions * mapGenOptions;
|
|
std::unique_ptr<CMap> map;
|
|
CRandomGenerator rand;
|
|
int randomSeed;
|
|
CMapEditManager * editManager;
|
|
};
|