1
0
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:
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

@ -15,6 +15,8 @@
#include "CDrawRoadsOperation.h"
#include "CMapOperation.h"
#include <vstd/RNG.h>
VCMI_LIB_NAMESPACE_BEGIN
CMapUndoManager::CMapUndoManager() :
@ -121,26 +123,26 @@ CMap * CMapEditManager::getMap()
return map;
}
void CMapEditManager::clearTerrain(CRandomGenerator * gen)
void CMapEditManager::clearTerrain(vstd::RNG * gen)
{
execute(std::make_unique<CClearTerrainOperation>(map, gen ? gen : &(this->gen)));
execute(std::make_unique<CClearTerrainOperation>(map, gen ? gen : this->gen.get()));
}
void CMapEditManager::drawTerrain(TerrainId terType, int decorationsPercentage, CRandomGenerator * gen)
void CMapEditManager::drawTerrain(TerrainId terType, int decorationsPercentage, vstd::RNG * gen)
{
execute(std::make_unique<CDrawTerrainOperation>(map, terrainSel, terType, decorationsPercentage, gen ? gen : &(this->gen)));
execute(std::make_unique<CDrawTerrainOperation>(map, terrainSel, terType, decorationsPercentage, gen ? gen : this->gen.get()));
terrainSel.clearSelection();
}
void CMapEditManager::drawRoad(RoadId roadType, CRandomGenerator* gen)
void CMapEditManager::drawRoad(RoadId roadType, vstd::RNG* gen)
{
execute(std::make_unique<CDrawRoadsOperation>(map, terrainSel, roadType, gen ? gen : &(this->gen)));
execute(std::make_unique<CDrawRoadsOperation>(map, terrainSel, roadType, gen ? gen : this->gen.get()));
terrainSel.clearSelection();
}
void CMapEditManager::drawRiver(RiverId riverType, CRandomGenerator* gen)
void CMapEditManager::drawRiver(RiverId riverType, vstd::RNG* gen)
{
execute(std::make_unique<CDrawRiversOperation>(map, terrainSel, riverType, gen ? gen : &(this->gen)));
execute(std::make_unique<CDrawRiversOperation>(map, terrainSel, riverType, gen ? gen : this->gen.get()));
terrainSel.clearSelection();
}