mirror of
https://github.com/vcmi/vcmi.git
synced 2025-05-31 22:59:54 +02:00
Use RandomGeneratorUtil::randomShuffle for reproducible gameplay
This commit is contained in:
parent
c8faca8f39
commit
fe6c0cf89b
@ -428,7 +428,7 @@ void ObstacleMechanics::applyBattleEffects(const SpellCastEnvironment * env, con
|
|||||||
if(hex.getX() > 2 && hex.getX() < 14 && !(parameters.cb->battleGetStackByPos(hex, false)) && !(parameters.cb->battleGetObstacleOnPos(hex, false)))
|
if(hex.getX() > 2 && hex.getX() < 14 && !(parameters.cb->battleGetStackByPos(hex, false)) && !(parameters.cb->battleGetObstacleOnPos(hex, false)))
|
||||||
availableTiles.push_back(hex);
|
availableTiles.push_back(hex);
|
||||||
}
|
}
|
||||||
boost::range::random_shuffle(availableTiles);
|
RandomGeneratorUtil::randomShuffle(availableTiles, env->getRandomGenerator());
|
||||||
|
|
||||||
const int patchesForSkill[] = {4, 4, 6, 8};
|
const int patchesForSkill[] = {4, 4, 6, 8};
|
||||||
const int patchesToPut = std::min<int>(patchesForSkill[parameters.spellLvl], availableTiles.size());
|
const int patchesToPut = std::min<int>(patchesForSkill[parameters.spellLvl], availableTiles.size());
|
||||||
|
@ -5740,7 +5740,7 @@ void CGameHandler::runBattle()
|
|||||||
|
|
||||||
if(!curOwner || curOwner->getSecSkillLevel(SecondarySkill::FIRST_AID) == 0) //no hero or hero has no first aid
|
if(!curOwner || curOwner->getSecSkillLevel(SecondarySkill::FIRST_AID) == 0) //no hero or hero has no first aid
|
||||||
{
|
{
|
||||||
range::random_shuffle(possibleStacks);
|
RandomGeneratorUtil::randomShuffle(possibleStacks, getRandomGenerator());
|
||||||
const CStack * toBeHealed = possibleStacks.front();
|
const CStack * toBeHealed = possibleStacks.front();
|
||||||
|
|
||||||
BattleAction heal;
|
BattleAction heal;
|
||||||
@ -5943,7 +5943,8 @@ void CGameHandler::spawnWanderingMonsters(CreatureID creatureID)
|
|||||||
std::vector<int3> tiles;
|
std::vector<int3> tiles;
|
||||||
getFreeTiles(tiles);
|
getFreeTiles(tiles);
|
||||||
ui32 amount = tiles.size() / 200; //Chance is 0.5% for each tile
|
ui32 amount = tiles.size() / 200; //Chance is 0.5% for each tile
|
||||||
std::random_shuffle(tiles.begin(), tiles.end());
|
|
||||||
|
RandomGeneratorUtil::randomShuffle(tiles, getRandomGenerator());
|
||||||
logGlobal->trace("Spawning wandering monsters. Found %d free tiles. Creature type: %d", tiles.size(), creatureID.num);
|
logGlobal->trace("Spawning wandering monsters. Found %d free tiles. Creature type: %d", tiles.size(), creatureID.num);
|
||||||
const CCreature *cre = VLC->creh->creatures.at(creatureID);
|
const CCreature *cre = VLC->creh->creatures.at(creatureID);
|
||||||
for (int i = 0; i < amount; ++i)
|
for (int i = 0; i < amount; ++i)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user