mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-15 00:05:02 +02:00
Replaced most of usages of CRandomGenerator with vstd::RNG in library
This commit is contained in:
@ -31,6 +31,8 @@
|
||||
#include "../networkPacks/PacksForClientBattle.h"
|
||||
#include "../serializer/JsonSerializeFormat.h"
|
||||
|
||||
#include <vstd/RNG.h>
|
||||
|
||||
VCMI_LIB_NAMESPACE_BEGIN
|
||||
|
||||
int CGTownInstance::getSightRadius() const //returns sight distance
|
||||
@ -379,7 +381,7 @@ bool CGTownInstance::isBonusingBuildingAdded(BuildingID bid) const
|
||||
return present != bonusingBuildings.end();
|
||||
}
|
||||
|
||||
void CGTownInstance::addTownBonuses(CRandomGenerator & rand)
|
||||
void CGTownInstance::addTownBonuses(vstd::RNG & rand)
|
||||
{
|
||||
for(const auto & kvp : town->buildings)
|
||||
{
|
||||
@ -461,7 +463,7 @@ void CGTownInstance::deleteTownBonus(BuildingID bid)
|
||||
delete freeIt;
|
||||
}
|
||||
|
||||
FactionID CGTownInstance::randomizeFaction(CRandomGenerator & rand)
|
||||
FactionID CGTownInstance::randomizeFaction(vstd::RNG & rand)
|
||||
{
|
||||
if(getOwner().isValidPlayer())
|
||||
return cb->gameState()->scenarioOps->getIthPlayersSettings(getOwner()).castle;
|
||||
@ -479,7 +481,7 @@ FactionID CGTownInstance::randomizeFaction(CRandomGenerator & rand)
|
||||
return *RandomGeneratorUtil::nextItem(potentialPicks, rand);
|
||||
}
|
||||
|
||||
void CGTownInstance::pickRandomObject(CRandomGenerator & rand)
|
||||
void CGTownInstance::pickRandomObject(vstd::RNG & rand)
|
||||
{
|
||||
assert(ID == MapObjectID::TOWN || ID == MapObjectID::RANDOM_TOWN);
|
||||
if (ID == MapObjectID::RANDOM_TOWN)
|
||||
@ -495,7 +497,7 @@ void CGTownInstance::pickRandomObject(CRandomGenerator & rand)
|
||||
updateAppearance();
|
||||
}
|
||||
|
||||
void CGTownInstance::initObj(CRandomGenerator & rand) ///initialize town structures
|
||||
void CGTownInstance::initObj(vstd::RNG & rand) ///initialize town structures
|
||||
{
|
||||
blockVisit = true;
|
||||
|
||||
@ -521,7 +523,7 @@ void CGTownInstance::initObj(CRandomGenerator & rand) ///initialize town structu
|
||||
updateAppearance();
|
||||
}
|
||||
|
||||
void CGTownInstance::newTurn(CRandomGenerator & rand) const
|
||||
void CGTownInstance::newTurn(vstd::RNG & rand) const
|
||||
{
|
||||
if (cb->getDate(Date::DAY_OF_WEEK) == 1) //reset on new week
|
||||
{
|
||||
|
Reference in New Issue
Block a user