summaryrefslogtreecommitdiffstats
path: root/src/Generating
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-10-20 22:55:07 +0200
committerarchshift <admin@archshift.com>2014-10-23 05:12:49 +0200
commita26541a7c3ced0569098edd0aae61c097c2912f4 (patch)
tree4b7bea204c0ddd18bb4f95357f9eb77590bc2e8d /src/Generating
parentComposableGenerator: Removed nullptr initializers. (diff)
downloadcuberite-a26541a7c3ced0569098edd0aae61c097c2912f4.tar
cuberite-a26541a7c3ced0569098edd0aae61c097c2912f4.tar.gz
cuberite-a26541a7c3ced0569098edd0aae61c097c2912f4.tar.bz2
cuberite-a26541a7c3ced0569098edd0aae61c097c2912f4.tar.lz
cuberite-a26541a7c3ced0569098edd0aae61c097c2912f4.tar.xz
cuberite-a26541a7c3ced0569098edd0aae61c097c2912f4.tar.zst
cuberite-a26541a7c3ced0569098edd0aae61c097c2912f4.zip
Diffstat (limited to 'src/Generating')
-rw-r--r--src/Generating/BioGen.cpp6
-rw-r--r--src/Generating/ChunkDesc.cpp4
-rw-r--r--src/Generating/ChunkDesc.h2
-rw-r--r--src/Generating/ChunkGenerator.cpp18
-rw-r--r--src/Generating/CompoGen.cpp4
-rw-r--r--src/Generating/ComposableGenerator.cpp6
-rw-r--r--src/Generating/DungeonRoomsFinisher.cpp2
-rw-r--r--src/Generating/GridStructGen.cpp2
-rw-r--r--src/Generating/HeiGen.cpp6
-rw-r--r--src/Generating/MineShafts.cpp18
-rw-r--r--src/Generating/PieceGenerator.cpp4
-rw-r--r--src/Generating/Prefab.cpp6
-rw-r--r--src/Generating/PrefabPiecePool.cpp6
-rw-r--r--src/Generating/VillageGen.cpp4
14 files changed, 44 insertions, 44 deletions
diff --git a/src/Generating/BioGen.cpp b/src/Generating/BioGen.cpp
index b9face1f8..d86d44bbc 100644
--- a/src/Generating/BioGen.cpp
+++ b/src/Generating/BioGen.cpp
@@ -69,9 +69,9 @@ cBioGenCache::cBioGenCache(cBiomeGenPtr a_BioGenToCache, int a_CacheSize) :
cBioGenCache::~cBioGenCache()
{
delete[] m_CacheData;
- m_CacheData = NULL;
+ m_CacheData = nullptr;
delete[] m_CacheOrder;
- m_CacheOrder = NULL;
+ m_CacheOrder = nullptr;
}
@@ -928,7 +928,7 @@ cBiomeGenPtr cBiomeGen::CreateBiomeGen(cIniFile & a_IniFile, int a_Seed, bool &
BiomeGenName = "MultiStepMap";
}
- cBiomeGen * res = NULL;
+ cBiomeGen * res = nullptr;
a_CacheOffByDefault = false;
if (NoCaseCompare(BiomeGenName, "constant") == 0)
{
diff --git a/src/Generating/ChunkDesc.cpp b/src/Generating/ChunkDesc.cpp
index 566332b1f..020d3bd0f 100644
--- a/src/Generating/ChunkDesc.cpp
+++ b/src/Generating/ChunkDesc.cpp
@@ -530,10 +530,10 @@ cBlockEntity * cChunkDesc::GetBlockEntity(int a_RelX, int a_RelY, int a_RelZ)
// The block entity is not created yet, try to create it and add to list:
cBlockEntity * be = cBlockEntity::CreateByBlockType(GetBlockType(a_RelX, a_RelY, a_RelZ), GetBlockMeta(a_RelX, a_RelY, a_RelZ), AbsX, a_RelY, AbsZ);
- if (be == NULL)
+ if (be == nullptr)
{
// No block entity for this block type
- return NULL;
+ return nullptr;
}
m_BlockEntities.push_back(be);
return be;
diff --git a/src/Generating/ChunkDesc.h b/src/Generating/ChunkDesc.h
index eeea0c957..570132790 100644
--- a/src/Generating/ChunkDesc.h
+++ b/src/Generating/ChunkDesc.h
@@ -172,7 +172,7 @@ public:
/** Returns the block entity at the specified coords.
If there is no block entity at those coords, tries to create one, based on the block type
- If the blocktype doesn't support a block entity, returns NULL. */
+ If the blocktype doesn't support a block entity, returns nullptr. */
cBlockEntity * GetBlockEntity(int a_RelX, int a_RelY, int a_RelZ);
/** Updates the heightmap to match the current contents.
diff --git a/src/Generating/ChunkGenerator.cpp b/src/Generating/ChunkGenerator.cpp
index d615456c1..1eecd6e51 100644
--- a/src/Generating/ChunkGenerator.cpp
+++ b/src/Generating/ChunkGenerator.cpp
@@ -28,9 +28,9 @@ const unsigned int QUEUE_SKIP_LIMIT = 500;
cChunkGenerator::cChunkGenerator(void) :
super("cChunkGenerator"),
m_Seed(0), // Will be overwritten by the actual generator
- m_Generator(NULL),
- m_PluginInterface(NULL),
- m_ChunkSink(NULL)
+ m_Generator(nullptr),
+ m_PluginInterface(nullptr),
+ m_ChunkSink(nullptr)
{
}
@@ -80,7 +80,7 @@ bool cChunkGenerator::Start(cPluginInterface & a_PluginInterface, cChunkSink & a
m_Generator = new cComposableGenerator(*this);
}
- if (m_Generator == NULL)
+ if (m_Generator == nullptr)
{
LOGERROR("Generator could not start, aborting the server");
return false;
@@ -103,7 +103,7 @@ void cChunkGenerator::Stop(void)
Wait();
delete m_Generator;
- m_Generator = NULL;
+ m_Generator = nullptr;
}
@@ -144,7 +144,7 @@ void cChunkGenerator::QueueGenerateChunk(int a_ChunkX, int a_ChunkZ, bool a_Forc
void cChunkGenerator::GenerateBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap)
{
- if (m_Generator != NULL)
+ if (m_Generator != nullptr)
{
m_Generator->GenerateBiomes(a_ChunkX, a_ChunkZ, a_BiomeMap);
}
@@ -180,7 +180,7 @@ int cChunkGenerator::GetQueueLength(void)
EMCSBiome cChunkGenerator::GetBiomeAt(int a_BlockX, int a_BlockZ)
{
- ASSERT(m_Generator != NULL);
+ ASSERT(m_Generator != nullptr);
return m_Generator->GetBiomeAt(a_BlockX, a_BlockZ);
}
@@ -283,8 +283,8 @@ void cChunkGenerator::Execute(void)
void cChunkGenerator::DoGenerate(int a_ChunkX, int a_ChunkZ)
{
- ASSERT(m_PluginInterface != NULL);
- ASSERT(m_ChunkSink != NULL);
+ ASSERT(m_PluginInterface != nullptr);
+ ASSERT(m_ChunkSink != nullptr);
ASSERT(m_ChunkSink->IsChunkQueued(a_ChunkX, a_ChunkZ));
cChunkDesc ChunkDesc(a_ChunkX, a_ChunkZ);
diff --git a/src/Generating/CompoGen.cpp b/src/Generating/CompoGen.cpp
index 0105fdb70..2c88f23f1 100644
--- a/src/Generating/CompoGen.cpp
+++ b/src/Generating/CompoGen.cpp
@@ -687,9 +687,9 @@ cCompoGenCache::cCompoGenCache(cTerrainCompositionGenPtr a_Underlying, int a_Cac
cCompoGenCache::~cCompoGenCache()
{
delete[] m_CacheData;
- m_CacheData = NULL;
+ m_CacheData = nullptr;
delete[] m_CacheOrder;
- m_CacheOrder = NULL;
+ m_CacheOrder = nullptr;
}
diff --git a/src/Generating/ComposableGenerator.cpp b/src/Generating/ComposableGenerator.cpp
index b5af4e96a..9a52588d5 100644
--- a/src/Generating/ComposableGenerator.cpp
+++ b/src/Generating/ComposableGenerator.cpp
@@ -48,7 +48,7 @@ cTerrainCompositionGenPtr cTerrainCompositionGen::CreateCompositionGen(cIniFile
CompoGenName = "Biomal";
}
- cTerrainCompositionGen * res = NULL;
+ cTerrainCompositionGen * res = nullptr;
if (NoCaseCompare(CompoGenName, "sameblock") == 0)
{
res = new cCompoGenSameBlock;
@@ -102,7 +102,7 @@ cTerrainCompositionGenPtr cTerrainCompositionGen::CreateCompositionGen(cIniFile
a_IniFile.SetValue("Generator", "CompositionGen", "Biomal");
return CreateCompositionGen(a_IniFile, a_BiomeGen, a_HeightGen, a_Seed);
}
- ASSERT(res != NULL);
+ ASSERT(res != nullptr);
// Read the settings from the ini file:
res->InitializeCompoGen(a_IniFile);
@@ -145,7 +145,7 @@ void cComposableGenerator::Initialize(cIniFile & a_IniFile)
void cComposableGenerator::GenerateBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_BiomeMap)
{
- if (m_BiomeGen != NULL) // Quick fix for generator deinitializing before the world storage finishes loading
+ if (m_BiomeGen != nullptr) // Quick fix for generator deinitializing before the world storage finishes loading
{
m_BiomeGen->GenBiomes(a_ChunkX, a_ChunkZ, a_BiomeMap);
}
diff --git a/src/Generating/DungeonRoomsFinisher.cpp b/src/Generating/DungeonRoomsFinisher.cpp
index 93fe8b472..3f328868d 100644
--- a/src/Generating/DungeonRoomsFinisher.cpp
+++ b/src/Generating/DungeonRoomsFinisher.cpp
@@ -198,7 +198,7 @@ protected:
} ;
cChestEntity * ChestEntity = (cChestEntity *)a_ChunkDesc.GetBlockEntity(RelX, m_FloorHeight + 1, RelZ);
- ASSERT((ChestEntity != NULL) && (ChestEntity->GetBlockType() == E_BLOCK_CHEST));
+ ASSERT((ChestEntity != nullptr) && (ChestEntity->GetBlockType() == E_BLOCK_CHEST));
cNoise Noise(a_ChunkDesc.GetChunkX() ^ a_ChunkDesc.GetChunkZ());
int NumSlots = 3 + ((Noise.IntNoise3DInt(a_Chest.x, a_Chest.y, a_Chest.z) / 11) % 4);
int Seed = Noise.IntNoise2DInt(RelX, RelZ);
diff --git a/src/Generating/GridStructGen.cpp b/src/Generating/GridStructGen.cpp
index 7090f14b1..3c08c1a39 100644
--- a/src/Generating/GridStructGen.cpp
+++ b/src/Generating/GridStructGen.cpp
@@ -135,7 +135,7 @@ void cGridStructGen::GetStructuresForChunk(int a_ChunkX, int a_ChunkZ, cStructur
int OriginX = GridX + ((m_Noise.IntNoise2DInt(GridX + 3, GridZ + 5) / 7) % (m_MaxOffsetX * 2)) - m_MaxOffsetX;
int OriginZ = GridZ + ((m_Noise.IntNoise2DInt(GridX + 5, GridZ + 3) / 7) % (m_MaxOffsetZ * 2)) - m_MaxOffsetZ;
cStructurePtr Structure = CreateStructure(GridX, GridZ, OriginX, OriginZ);
- if (Structure.get() == NULL)
+ if (Structure.get() == nullptr)
{
Structure.reset(new cEmptyStructure(GridX, GridZ, OriginX, OriginZ));
}
diff --git a/src/Generating/HeiGen.cpp b/src/Generating/HeiGen.cpp
index b7d4b337c..acfefaefc 100644
--- a/src/Generating/HeiGen.cpp
+++ b/src/Generating/HeiGen.cpp
@@ -29,7 +29,7 @@ cTerrainHeightGenPtr cTerrainHeightGen::CreateHeightGen(cIniFile & a_IniFile, cB
}
a_CacheOffByDefault = false;
- cTerrainHeightGen * res = NULL;
+ cTerrainHeightGen * res = nullptr;
if (NoCaseCompare(HeightGenName, "flat") == 0)
{
res = new cHeiGenFlat;
@@ -142,9 +142,9 @@ cHeiGenCache::cHeiGenCache(cTerrainHeightGenPtr a_HeiGenToCache, int a_CacheSize
cHeiGenCache::~cHeiGenCache()
{
delete[] m_CacheData;
- m_CacheData = NULL;
+ m_CacheData = nullptr;
delete[] m_CacheOrder;
- m_CacheOrder = NULL;
+ m_CacheOrder = nullptr;
}
diff --git a/src/Generating/MineShafts.cpp b/src/Generating/MineShafts.cpp
index 0532aff39..55b3b64dd 100644
--- a/src/Generating/MineShafts.cpp
+++ b/src/Generating/MineShafts.cpp
@@ -112,7 +112,7 @@ class cMineShaftCorridor :
public:
/** Creates a new Corridor attached to the specified pivot point and direction.
Checks all ParentSystem's objects and disallows intersecting. Initializes the new object to fit.
- May return NULL if cannot fit.
+ May return nullptr if cannot fit.
*/
static cMineShaft * CreateAndFit(
cStructGenMineShafts::cMineShaftSystem & a_ParentSystem,
@@ -165,7 +165,7 @@ class cMineShaftCrossing :
public:
/** Creates a new Crossing attached to the specified pivot point and direction.
Checks all ParentSystem's objects and disallows intersecting. Initializes the new object to fit.
- May return NULL if cannot fit.
+ May return nullptr if cannot fit.
*/
static cMineShaft * CreateAndFit(
cStructGenMineShafts::cMineShaftSystem & a_ParentSystem,
@@ -199,7 +199,7 @@ public:
/** Creates a new Staircase attached to the specified pivot point and direction.
Checks all ParentSystem's objects and disallows intersecting. Initializes the new object to fit.
- May return NULL if cannot fit.
+ May return nullptr if cannot fit.
*/
static cMineShaft * CreateAndFit(
cStructGenMineShafts::cMineShaftSystem & a_ParentSystem,
@@ -351,7 +351,7 @@ void cStructGenMineShafts::cMineShaftSystem::AppendBranch(
return;
}
- cMineShaft * Next = NULL;
+ cMineShaft * Next = nullptr;
int rnd = (a_Noise.IntNoise3DInt(a_PivotX, a_PivotY + a_RecursionLevel * 16, a_PivotZ) / 13) % m_ProbLevelStaircase;
if (rnd < m_ProbLevelCorridor)
{
@@ -365,7 +365,7 @@ void cStructGenMineShafts::cMineShaftSystem::AppendBranch(
{
Next = cMineShaftStaircase::CreateAndFit(*this, a_PivotX, a_PivotY, a_PivotZ, a_Direction, a_Noise);
}
- if (Next == NULL)
+ if (Next == nullptr)
{
return;
}
@@ -552,7 +552,7 @@ cMineShaft * cMineShaftCorridor::CreateAndFit(
}
if (!a_ParentSystem.CanAppend(BoundingBox))
{
- return NULL;
+ return nullptr;
}
return new cMineShaftCorridor(a_ParentSystem, BoundingBox, NumSegments, a_Direction, a_Noise);
}
@@ -796,7 +796,7 @@ void cMineShaftCorridor::PlaceChest(cChunkDesc & a_ChunkDesc)
{
a_ChunkDesc.SetBlockTypeMeta(x, m_BoundingBox.p1.y + 1, z, E_BLOCK_CHEST, Meta);
cChestEntity * ChestEntity = (cChestEntity *)a_ChunkDesc.GetBlockEntity(x, m_BoundingBox.p1.y + 1, z);
- ASSERT((ChestEntity != NULL) && (ChestEntity->GetBlockType() == E_BLOCK_CHEST));
+ ASSERT((ChestEntity != nullptr) && (ChestEntity->GetBlockType() == E_BLOCK_CHEST));
cNoise Noise(a_ChunkDesc.GetChunkX() ^ a_ChunkDesc.GetChunkZ());
int NumSlots = 3 + ((Noise.IntNoise3DInt(x, m_BoundingBox.p1.y, z) / 11) % 4);
int Seed = Noise.IntNoise2DInt(x, z);
@@ -1006,7 +1006,7 @@ cMineShaft * cMineShaftCrossing::CreateAndFit(
}
if (!a_ParentSystem.CanAppend(BoundingBox))
{
- return NULL;
+ return nullptr;
}
return new cMineShaftCrossing(a_ParentSystem, BoundingBox);
}
@@ -1157,7 +1157,7 @@ cMineShaft * cMineShaftStaircase::CreateAndFit(
}
if (!a_ParentSystem.CanAppend(Box))
{
- return NULL;
+ return nullptr;
}
return new cMineShaftStaircase(a_ParentSystem, Box, a_Direction, Slope);
}
diff --git a/src/Generating/PieceGenerator.cpp b/src/Generating/PieceGenerator.cpp
index ae4b6e36c..97aa646fc 100644
--- a/src/Generating/PieceGenerator.cpp
+++ b/src/Generating/PieceGenerator.cpp
@@ -289,7 +289,7 @@ cPlacedPiece::cPlacedPiece(const cPlacedPiece * a_Parent, const cPiece & a_Piece
m_NumCCWRotations(a_NumCCWRotations),
m_HasBeenMovedToGround(false)
{
- m_Depth = (m_Parent == NULL) ? 0 : (m_Parent->GetDepth() + 1);
+ m_Depth = (m_Parent == nullptr) ? 0 : (m_Parent->GetDepth() + 1);
m_HitBox = a_Piece.RotateMoveHitBox(a_NumCCWRotations, a_Coords.x, a_Coords.y, a_Coords.z);
m_HitBox.Sort();
}
@@ -402,7 +402,7 @@ cPlacedPiece * cPieceGenerator::PlaceStartingPiece(int a_BlockX, int a_BlockY, i
}
int Rotation = Rotations[rnd % NumRotations];
- cPlacedPiece * res = new cPlacedPiece(NULL, *StartingPiece, Vector3i(a_BlockX, a_BlockY, a_BlockZ), Rotation);
+ cPlacedPiece * res = new cPlacedPiece(nullptr, *StartingPiece, Vector3i(a_BlockX, a_BlockY, a_BlockZ), Rotation);
// Place the piece's connectors into a_OutConnectors:
const cPiece::cConnectors & Conn = StartingPiece->GetConnectors();
diff --git a/src/Generating/Prefab.cpp b/src/Generating/Prefab.cpp
index 6da3c3d10..761986690 100644
--- a/src/Generating/Prefab.cpp
+++ b/src/Generating/Prefab.cpp
@@ -328,7 +328,7 @@ void cPrefab::AddConnector(int a_RelX, int a_RelY, int a_RelZ, eBlockFace a_Dire
void cPrefab::ParseCharMap(CharMap & a_CharMapOut, const char * a_CharMapDef)
{
- ASSERT(a_CharMapDef != NULL);
+ ASSERT(a_CharMapDef != nullptr);
// Initialize the charmap to all-invalid values:
for (size_t i = 0; i < ARRAYCOUNT(a_CharMapOut); i++)
@@ -389,7 +389,7 @@ void cPrefab::ParseBlockImage(const CharMap & a_CharMap, const char * a_BlockIma
void cPrefab::ParseConnectors(const char * a_ConnectorsDef)
{
- ASSERT(a_ConnectorsDef != NULL);
+ ASSERT(a_ConnectorsDef != nullptr);
AStringVector Lines = StringSplitAndTrim(a_ConnectorsDef, "\n");
for (AStringVector::const_iterator itr = Lines.begin(), end = Lines.end(); itr != end; ++itr)
@@ -436,7 +436,7 @@ void cPrefab::ParseConnectors(const char * a_ConnectorsDef)
void cPrefab::ParseDepthWeight(const char * a_DepthWeightDef)
{
// The member needn't be defined at all, if so, skip:
- if (a_DepthWeightDef == NULL)
+ if (a_DepthWeightDef == nullptr)
{
return;
}
diff --git a/src/Generating/PrefabPiecePool.cpp b/src/Generating/PrefabPiecePool.cpp
index 122b9d2af..895555ef8 100644
--- a/src/Generating/PrefabPiecePool.cpp
+++ b/src/Generating/PrefabPiecePool.cpp
@@ -16,7 +16,7 @@ cPrefabPiecePool::cPrefabPiecePool(
)
{
AddPieceDefs(a_PieceDefs, a_NumPieceDefs);
- if (a_StartingPieceDefs != NULL)
+ if (a_StartingPieceDefs != nullptr)
{
AddStartingPieceDefs(a_StartingPieceDefs, a_NumStartingPieceDefs);
}
@@ -56,7 +56,7 @@ void cPrefabPiecePool::Clear(void)
void cPrefabPiecePool::AddPieceDefs(const cPrefab::sDef * a_PieceDefs, size_t a_NumPieceDefs)
{
- ASSERT(a_PieceDefs != NULL);
+ ASSERT(a_PieceDefs != nullptr);
for (size_t i = 0; i < a_NumPieceDefs; i++)
{
cPrefab * Prefab = new cPrefab(a_PieceDefs[i]);
@@ -71,7 +71,7 @@ void cPrefabPiecePool::AddPieceDefs(const cPrefab::sDef * a_PieceDefs, size_t a_
void cPrefabPiecePool::AddStartingPieceDefs(const cPrefab::sDef * a_StartingPieceDefs, size_t a_NumStartingPieceDefs)
{
- ASSERT(a_StartingPieceDefs != NULL);
+ ASSERT(a_StartingPieceDefs != nullptr);
for (size_t i = 0; i < a_NumStartingPieceDefs; i++)
{
cPrefab * Prefab = new cPrefab(a_StartingPieceDefs[i]);
diff --git a/src/Generating/VillageGen.cpp b/src/Generating/VillageGen.cpp
index 1806fd427..a9b359b6a 100644
--- a/src/Generating/VillageGen.cpp
+++ b/src/Generating/VillageGen.cpp
@@ -385,7 +385,7 @@ cGridStructGen::cStructurePtr cVillageGen::CreateStructure(int a_GridX, int a_Gr
// Check if all the biomes are village-friendly:
// If just one is not, no village is created, because it's likely that an unfriendly biome is too close
- cVillagePiecePool * VillagePrefabs = NULL;
+ cVillagePiecePool * VillagePrefabs = nullptr;
BLOCKTYPE RoadBlock = E_BLOCK_GRAVEL;
BLOCKTYPE WaterRoadBlock = E_BLOCK_PLANKS;
int rnd = m_Noise.IntNoise2DInt(a_OriginX, a_OriginZ) / 11;
@@ -432,7 +432,7 @@ cGridStructGen::cStructurePtr cVillageGen::CreateStructure(int a_GridX, int a_Gr
}
// Create a village based on the chosen prefabs:
- if (VillagePrefabs == NULL)
+ if (VillagePrefabs == nullptr)
{
return cStructurePtr();
}