mirror of
https://github.com/vcmi/vcmi.git
synced 2025-12-01 23:12:49 +02:00
Replaced most of usages of CRandomGenerator with vstd::RNG in library
This commit is contained in:
@@ -26,6 +26,8 @@
|
||||
#include "WaterProxy.h"
|
||||
#include "TownPlacer.h"
|
||||
|
||||
#include <vstd/RNG.h>
|
||||
|
||||
VCMI_LIB_NAMESPACE_BEGIN
|
||||
|
||||
std::pair<Zone::Lock, Zone::Lock> ConnectionsPlacer::lockZones(std::shared_ptr<Zone> otherZone)
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
#include "WaterAdopter.h"
|
||||
#include "../TileInfo.h"
|
||||
|
||||
#include <vstd/RNG.h>
|
||||
|
||||
VCMI_LIB_NAMESPACE_BEGIN
|
||||
|
||||
void MinePlacer::process()
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
#include "../Functions.h"
|
||||
#include "../RmgObject.h"
|
||||
|
||||
#include <vstd/RNG.h>
|
||||
|
||||
VCMI_LIB_NAMESPACE_BEGIN
|
||||
|
||||
void ObjectDistributor::process()
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
#include "../Functions.h"
|
||||
#include "../RmgObject.h"
|
||||
|
||||
#include <vstd/RNG.h>
|
||||
|
||||
VCMI_LIB_NAMESPACE_BEGIN
|
||||
|
||||
void ObjectManager::process()
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include "RiverPlacer.h"
|
||||
#include "../RmgMap.h"
|
||||
#include "../CMapGenerator.h"
|
||||
#include "../../CRandomGenerator.h"
|
||||
#include "../Functions.h"
|
||||
#include "../../mapping/CMapEditManager.h"
|
||||
#include "../../mapping/CMap.h"
|
||||
|
||||
@@ -17,7 +17,9 @@
|
||||
#include "../../VCMI_Lib.h"
|
||||
#include "../../mapObjectConstructors/AObjectTypeHandler.h"
|
||||
#include "../../mapObjectConstructors/CObjectClassesHandler.h"
|
||||
#include "../../mapObjects/MapObjects.h"
|
||||
#include "../../mapObjects/MapObjects.h"
|
||||
|
||||
#include <vstd/RNG.h>
|
||||
|
||||
VCMI_LIB_NAMESPACE_BEGIN
|
||||
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
|
||||
VCMI_LIB_NAMESPACE_BEGIN
|
||||
|
||||
class CRandomGenerator;
|
||||
|
||||
class PrisonHeroPlacer : public Modificator
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -17,7 +17,9 @@
|
||||
#include "../../VCMI_Lib.h"
|
||||
#include "../../mapObjectConstructors/AObjectTypeHandler.h"
|
||||
#include "../../mapObjectConstructors/CObjectClassesHandler.h"
|
||||
#include "../../mapObjects/MapObjects.h"
|
||||
#include "../../mapObjects/MapObjects.h"
|
||||
|
||||
#include <vstd/RNG.h>
|
||||
|
||||
VCMI_LIB_NAMESPACE_BEGIN
|
||||
|
||||
@@ -95,7 +97,7 @@ void QuestArtifactPlacer::findZonesForQuestArts()
|
||||
logGlobal->trace("Number of nearby zones suitable for quest artifacts: %d", questArtZones.size());
|
||||
}
|
||||
|
||||
void QuestArtifactPlacer::placeQuestArtifacts(CRandomGenerator & rand)
|
||||
void QuestArtifactPlacer::placeQuestArtifacts(vstd::RNG & rand)
|
||||
{
|
||||
for (const auto & artifactToPlace : questArtifactsToPlace)
|
||||
{
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
|
||||
VCMI_LIB_NAMESPACE_BEGIN
|
||||
|
||||
class CRandomGenerator;
|
||||
|
||||
class QuestArtifactPlacer : public Modificator
|
||||
{
|
||||
public:
|
||||
@@ -33,7 +31,7 @@ public:
|
||||
void rememberPotentialArtifactToReplace(CGObjectInstance* obj);
|
||||
CGObjectInstance * drawObjectToReplace();
|
||||
std::vector<CGObjectInstance*> getPossibleArtifactsToReplace() const;
|
||||
void placeQuestArtifacts(CRandomGenerator & rand);
|
||||
void placeQuestArtifacts(vstd::RNG & rand);
|
||||
void dropReplacedArtifact(CGObjectInstance* obj);
|
||||
|
||||
size_t getMaxQuestArtifactCount() const;
|
||||
@@ -50,4 +48,4 @@ protected:
|
||||
std::vector<ArtifactID> questArtifacts;
|
||||
};
|
||||
|
||||
VCMI_LIB_NAMESPACE_END
|
||||
VCMI_LIB_NAMESPACE_END
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
#include "WaterProxy.h"
|
||||
#include "RoadPlacer.h"
|
||||
|
||||
#include <vstd/RNG.h>
|
||||
|
||||
VCMI_LIB_NAMESPACE_BEGIN
|
||||
|
||||
const int RIVER_DELTA_ID = 143;
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include "../CMapGenerator.h"
|
||||
#include "../Functions.h"
|
||||
#include "../../TerrainHandler.h"
|
||||
#include "../../CRandomGenerator.h"
|
||||
#include "../lib/mapping/CMapEditManager.h"
|
||||
#include "../TileInfo.h"
|
||||
#include "../threadpool/MapProxy.h"
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include "../CMapGenerator.h"
|
||||
#include "../Functions.h"
|
||||
#include "../../TerrainHandler.h"
|
||||
#include "../../CRandomGenerator.h"
|
||||
#include "../../mapping/CMapEditManager.h"
|
||||
#include "../../VCMI_Lib.h"
|
||||
#include "../TileInfo.h"
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
#include "../../TerrainHandler.h"
|
||||
#include "../../CTownHandler.h"
|
||||
|
||||
#include <vstd/RNG.h>
|
||||
|
||||
VCMI_LIB_NAMESPACE_BEGIN
|
||||
|
||||
void TerrainPainter::process()
|
||||
|
||||
@@ -27,6 +27,8 @@
|
||||
#include "WaterAdopter.h"
|
||||
#include "../TileInfo.h"
|
||||
|
||||
#include <vstd/RNG.h>
|
||||
|
||||
VCMI_LIB_NAMESPACE_BEGIN
|
||||
|
||||
void TownPlacer::process()
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
#include "../../mapping/CMap.h"
|
||||
#include "../../mapping/CMapEditManager.h"
|
||||
|
||||
#include <vstd/RNG.h>
|
||||
|
||||
VCMI_LIB_NAMESPACE_BEGIN
|
||||
|
||||
ObjectInfo::ObjectInfo():
|
||||
@@ -649,7 +651,7 @@ std::vector<ObjectInfo*> TreasurePlacer::prepareTreasurePile(const CTreasureInfo
|
||||
if (currentValue >= minValue)
|
||||
{
|
||||
// 50% chance to end right here
|
||||
if (zone.getRand().nextInt() & 1)
|
||||
if (zone.getRand().nextInt(0, 1) == 1)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ class CGObjectInstance;
|
||||
class ObjectManager;
|
||||
class RmgMap;
|
||||
class CMapGenerator;
|
||||
class CRandomGenerator;
|
||||
|
||||
struct ObjectInfo
|
||||
{
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
#include "ConnectionsPlacer.h"
|
||||
#include "../TileInfo.h"
|
||||
|
||||
#include <vstd/RNG.h>
|
||||
|
||||
VCMI_LIB_NAMESPACE_BEGIN
|
||||
|
||||
void WaterAdopter::process()
|
||||
|
||||
@@ -30,6 +30,8 @@
|
||||
#include "WaterAdopter.h"
|
||||
#include "../RmgArea.h"
|
||||
|
||||
#include <vstd/RNG.h>
|
||||
|
||||
VCMI_LIB_NAMESPACE_BEGIN
|
||||
|
||||
void WaterProxy::process()
|
||||
|
||||
Reference in New Issue
Block a user