mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-23 22:37:55 +02:00
Give every Zone its own RNG
This commit is contained in:
@@ -23,14 +23,14 @@ std::function<bool(const int3 &)> AREA_NO_FILTER = [](const int3 & t)
|
||||
return true;
|
||||
};
|
||||
|
||||
Zone::Zone(RmgMap & map, CMapGenerator & generator)
|
||||
Zone::Zone(RmgMap & map, CMapGenerator & generator, CRandomGenerator & r)
|
||||
: finished(false)
|
||||
, townType(ETownType::NEUTRAL)
|
||||
, terrainType(ETerrainId::GRASS)
|
||||
, map(map)
|
||||
, generator(generator)
|
||||
{
|
||||
|
||||
rand.setSeed(r.nextInt());
|
||||
}
|
||||
|
||||
bool Zone::isUnderground() const
|
||||
@@ -214,7 +214,7 @@ void Zone::fractalize()
|
||||
{
|
||||
//link tiles in random order
|
||||
std::vector<int3> tilesToMakePath = possibleTiles.getTilesVector();
|
||||
RandomGeneratorUtil::randomShuffle(tilesToMakePath, generator.rand);
|
||||
RandomGeneratorUtil::randomShuffle(tilesToMakePath, getRand());
|
||||
|
||||
int3 nodeFound(-1, -1, -1);
|
||||
|
||||
@@ -290,4 +290,9 @@ void Zone::initModificators()
|
||||
logGlobal->info("Zone %d modificators initialized", getId());
|
||||
}
|
||||
|
||||
CRandomGenerator& Zone::getRand()
|
||||
{
|
||||
return rand;
|
||||
}
|
||||
|
||||
VCMI_LIB_NAMESPACE_END
|
||||
|
||||
Reference in New Issue
Block a user