1
0
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:
Ivan Savenko
2024-06-01 15:28:17 +00:00
parent 60a51e98de
commit 63bcf7d83c
125 changed files with 620 additions and 409 deletions

View File

@@ -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