mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Restored old function signature for sanity.
This commit is contained in:
parent
713912574a
commit
3acbda75ef
@ -815,8 +815,8 @@ void CGameState::initNewGame()
|
||||
CStopWatch sw;
|
||||
|
||||
// Gen map
|
||||
CMapGenerator mapGenerator(scenarioOps->mapGenOptions, scenarioOps->seedToBeUsed);
|
||||
map = mapGenerator.generate().release();
|
||||
CMapGenerator mapGenerator;
|
||||
map = mapGenerator.generate(scenarioOps->mapGenOptions.get(), scenarioOps->seedToBeUsed).release();
|
||||
|
||||
// Update starting options
|
||||
for(int i = 0; i < map->players.size(); ++i)
|
||||
|
@ -24,10 +24,9 @@ void CMapGenerator::foreach_neighbour(const int3 &pos, std::function<void(int3&
|
||||
}
|
||||
|
||||
|
||||
CMapGenerator::CMapGenerator(shared_ptr<CMapGenOptions> mapGenOptions, int RandomSeed /*= std::time(nullptr)*/) :
|
||||
mapGenOptions(mapGenOptions), randomSeed(RandomSeed), monolithIndex(0), zonesTotal(0)
|
||||
CMapGenerator::CMapGenerator() :
|
||||
monolithIndex(0), zonesTotal(0)
|
||||
{
|
||||
rand.setSeed(randomSeed);
|
||||
}
|
||||
|
||||
void CMapGenerator::initTiles()
|
||||
@ -78,8 +77,11 @@ void CMapGenerator::initPrisonsRemaining()
|
||||
prisonsRemaining = std::max<int> (0, prisonsRemaining - 16 * map->players.size()); //so at least 16 heroes will be available for every player
|
||||
}
|
||||
|
||||
std::unique_ptr<CMap> CMapGenerator::generate()
|
||||
std::unique_ptr<CMap> CMapGenerator::generate(CMapGenOptions * mapGenOptions, int randomSeed /*= std::time(nullptr)*/)
|
||||
{
|
||||
this->mapGenOptions = mapGenOptions;
|
||||
this->randomSeed = randomSeed;
|
||||
rand.setSeed(this->randomSeed);
|
||||
mapGenOptions->finalize(rand);
|
||||
|
||||
map = make_unique<CMap>();
|
||||
@ -95,7 +97,7 @@ std::unique_ptr<CMap> CMapGenerator::generate()
|
||||
genZones();
|
||||
map->calculateGuardingGreaturePositions(); //clear map so that all tiles are unguarded
|
||||
fillZones();
|
||||
//updated fuarded tiles will be calculated in CGameState::initMapObjects()
|
||||
//updated guarded tiles will be calculated in CGameState::initMapObjects()
|
||||
}
|
||||
catch (rmgException &e)
|
||||
{
|
||||
|
@ -51,12 +51,12 @@ public:
|
||||
class DLL_LINKAGE CMapGenerator
|
||||
{
|
||||
public:
|
||||
explicit CMapGenerator(shared_ptr<CMapGenOptions> mapGenOptions, int RandomSeed = std::time(nullptr));
|
||||
explicit CMapGenerator();
|
||||
~CMapGenerator(); // required due to unique_ptr
|
||||
|
||||
std::unique_ptr<CMap> generate();
|
||||
std::unique_ptr<CMap> generate(CMapGenOptions * mapGenOptions, int RandomSeed = std::time(nullptr));
|
||||
|
||||
shared_ptr<CMapGenOptions> mapGenOptions;
|
||||
CMapGenOptions * mapGenOptions;
|
||||
std::unique_ptr<CMap> map;
|
||||
CRandomGenerator rand;
|
||||
int randomSeed;
|
||||
|
@ -38,7 +38,7 @@ int3 CZonePlacer::cords (const float3 f) const
|
||||
return int3(std::max(0.f, (f.x * gen->map->width)-1), std::max(0.f, (f.y * gen->map->height-1)), f.z);
|
||||
}
|
||||
|
||||
void CZonePlacer::placeZones(shared_ptr<CMapGenOptions> mapGenOptions, CRandomGenerator * rand)
|
||||
void CZonePlacer::placeZones(const CMapGenOptions * mapGenOptions, CRandomGenerator * rand)
|
||||
{
|
||||
//gravity-based algorithm
|
||||
|
||||
@ -207,7 +207,7 @@ d = 0.01 * dx^3 - 0.1618 * dx^2 + 1 * dx + ...
|
||||
return dx * (1 + dx * (0.1 + dx * 0.01)) + dy * (1.618 + dy * (-0.1618 + dy * 0.01618));
|
||||
}
|
||||
|
||||
void CZonePlacer::assignZones(shared_ptr<CMapGenOptions> mapGenOptions)
|
||||
void CZonePlacer::assignZones(const CMapGenOptions * mapGenOptions)
|
||||
{
|
||||
logGlobal->infoStream() << "Starting zone colouring";
|
||||
|
||||
|
@ -43,8 +43,8 @@ public:
|
||||
float metric (const int3 &a, const int3 &b) const;
|
||||
~CZonePlacer();
|
||||
|
||||
void placeZones(shared_ptr<CMapGenOptions> mapGenOptions, CRandomGenerator * rand);
|
||||
void assignZones(shared_ptr<CMapGenOptions> mapGenOptions);
|
||||
void placeZones(const CMapGenOptions * mapGenOptions, CRandomGenerator * rand);
|
||||
void assignZones(const CMapGenOptions * mapGenOptions);
|
||||
|
||||
private:
|
||||
//metric coefiicients
|
||||
|
Loading…
Reference in New Issue
Block a user