mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-27 22:49:25 +02:00
Replaced most of usages of CRandomGenerator with vstd::RNG in library
This commit is contained in:
@@ -17,6 +17,10 @@
|
||||
#include "RmgPath.h"
|
||||
#include "modificators/ObjectManager.h"
|
||||
|
||||
#include "../CRandomGenerator.h"
|
||||
|
||||
#include <vstd/RNG.h>
|
||||
|
||||
VCMI_LIB_NAMESPACE_BEGIN
|
||||
|
||||
const std::function<bool(const int3 &)> AREA_NO_FILTER = [](const int3 & t)
|
||||
@@ -24,16 +28,18 @@ const std::function<bool(const int3 &)> AREA_NO_FILTER = [](const int3 & t)
|
||||
return true;
|
||||
};
|
||||
|
||||
Zone::Zone(RmgMap & map, CMapGenerator & generator, CRandomGenerator & r)
|
||||
Zone::Zone(RmgMap & map, CMapGenerator & generator, vstd::RNG & r)
|
||||
: finished(false)
|
||||
, townType(ETownType::NEUTRAL)
|
||||
, terrainType(ETerrainId::GRASS)
|
||||
, map(map)
|
||||
, rand(std::make_unique<CRandomGenerator>(r.nextInt()))
|
||||
, generator(generator)
|
||||
{
|
||||
rand.setSeed(r.nextInt());
|
||||
}
|
||||
|
||||
Zone::~Zone() = default;
|
||||
|
||||
bool Zone::isUnderground() const
|
||||
{
|
||||
return getPos().z;
|
||||
@@ -401,9 +407,9 @@ void Zone::initModificators()
|
||||
}
|
||||
}
|
||||
|
||||
CRandomGenerator& Zone::getRand()
|
||||
vstd::RNG& Zone::getRand()
|
||||
{
|
||||
return rand;
|
||||
return *rand;
|
||||
}
|
||||
|
||||
VCMI_LIB_NAMESPACE_END
|
||||
|
||||
Reference in New Issue
Block a user