summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-12-17 00:18:59 +0100
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-12-17 00:18:59 +0100
commit8d9049603bba72f55f1fa9e47f281bb7d8bfca37 (patch)
treefa2bc45598eaf41da3a88960c1b4850f93c7b7f7 /src
parentRemoved test (diff)
downloadcuberite-8d9049603bba72f55f1fa9e47f281bb7d8bfca37.tar
cuberite-8d9049603bba72f55f1fa9e47f281bb7d8bfca37.tar.gz
cuberite-8d9049603bba72f55f1fa9e47f281bb7d8bfca37.tar.bz2
cuberite-8d9049603bba72f55f1fa9e47f281bb7d8bfca37.tar.lz
cuberite-8d9049603bba72f55f1fa9e47f281bb7d8bfca37.tar.xz
cuberite-8d9049603bba72f55f1fa9e47f281bb7d8bfca37.tar.zst
cuberite-8d9049603bba72f55f1fa9e47f281bb7d8bfca37.zip
Diffstat (limited to 'src')
-rw-r--r--src/BlockEntities/MobSpawnerEntity.cpp4
-rw-r--r--src/Blocks/BlockTallGrass.h2
-rw-r--r--src/ChunkMap.cpp2
-rw-r--r--src/Simulator/IncrementalRedstoneSimulator.cpp24
-rw-r--r--src/Simulator/IncrementalRedstoneSimulator.h8
5 files changed, 22 insertions, 18 deletions
diff --git a/src/BlockEntities/MobSpawnerEntity.cpp b/src/BlockEntities/MobSpawnerEntity.cpp
index 5edee888a..a7d29638a 100644
--- a/src/BlockEntities/MobSpawnerEntity.cpp
+++ b/src/BlockEntities/MobSpawnerEntity.cpp
@@ -150,7 +150,7 @@ void cMobSpawnerEntity::SpawnEntity(void)
int RelZ = (int) (m_RelZ + (double)(Random.NextFloat() - Random.NextFloat()) * 4.0);
cChunk * Chunk = a_Chunk->GetRelNeighborChunkAdjustCoords(RelX, RelZ);
- if ((Chunk == NULL) || !Chunk->IsValid())
+ if ((Chunk == nullptr) || !Chunk->IsValid())
{
continue;
}
@@ -162,7 +162,7 @@ void cMobSpawnerEntity::SpawnEntity(void)
double PosZ = Chunk->GetPosZ() * cChunkDef::Width + RelZ;
cMonster * Monster = cMonster::NewMonsterFromType(m_MobType);
- if (Monster == NULL)
+ if (Monster == nullptr)
{
continue;
}
diff --git a/src/Blocks/BlockTallGrass.h b/src/Blocks/BlockTallGrass.h
index 8e821b899..4134a01f8 100644
--- a/src/Blocks/BlockTallGrass.h
+++ b/src/Blocks/BlockTallGrass.h
@@ -38,7 +38,7 @@ public:
virtual void DropBlock(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cBlockPluginInterface & a_BlockPluginInterface, cEntity * a_Digger, int a_BlockX, int a_BlockY, int a_BlockZ, bool a_CanDrop) override
{
- if (a_CanDrop && (a_Digger != NULL) && (a_Digger->GetEquippedWeapon().m_ItemType == E_ITEM_SHEARS))
+ if (a_CanDrop && (a_Digger != nullptr) && (a_Digger->GetEquippedWeapon().m_ItemType == E_ITEM_SHEARS))
{
NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
cItems Drops;
diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp
index 222a756b1..6aff3a754 100644
--- a/src/ChunkMap.cpp
+++ b/src/ChunkMap.cpp
@@ -3075,7 +3075,7 @@ void cChunkMap::cChunkLayer::UnloadUnusedChunks(void)
)
{
// The cChunk destructor calls our GetChunk() while removing its entities
- // so we still need to be able to return the chunk. Therefore we first delete, then NULLify
+ // so we still need to be able to return the chunk. Therefore we first delete, then nullptrify
// Doing otherwise results in bug http://forum.mc-server.org/showthread.php?tid=355
delete m_Chunks[i];
m_Chunks[i] = nullptr;
diff --git a/src/Simulator/IncrementalRedstoneSimulator.cpp b/src/Simulator/IncrementalRedstoneSimulator.cpp
index f69412aa6..8a56287a8 100644
--- a/src/Simulator/IncrementalRedstoneSimulator.cpp
+++ b/src/Simulator/IncrementalRedstoneSimulator.cpp
@@ -27,7 +27,7 @@ typedef cItemCallback<cChestEntity> cChestCallback;
void cIncrementalRedstoneSimulator::RedstoneAddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk, cChunk * a_OtherChunk)
{
- if ((a_Chunk == NULL) || !a_Chunk->IsValid())
+ if ((a_Chunk == nullptr) || !a_Chunk->IsValid())
{
return;
}
@@ -45,13 +45,13 @@ void cIncrementalRedstoneSimulator::RedstoneAddBlock(int a_BlockX, int a_BlockY,
BLOCKTYPE Block;
NIBBLETYPE Meta;
- if (a_OtherChunk != NULL)
+ if (a_OtherChunk != nullptr)
{
RelX = a_BlockX - a_OtherChunk->GetPosX() * cChunkDef::Width;
RelZ = a_BlockZ - a_OtherChunk->GetPosZ() * cChunkDef::Width;
a_OtherChunk->GetBlockTypeMeta(RelX, a_BlockY, RelZ, Block, Meta);
- // If a_OtherChunk is passed (not NULL), it is the chunk that had a block change, and a_Chunk will be the neighbouring chunk of that block
+ // If a_OtherChunk is passed (not nullptr), it is the chunk that had a block change, and a_Chunk will be the neighbouring chunk of that block
// Because said neighbouring chunk does not know of this change but still needs to update its redstone, we set it to dirty
a_Chunk->SetIsRedstoneDirty(true);
}
@@ -100,7 +100,7 @@ void cIncrementalRedstoneSimulator::RedstoneAddBlock(int a_BlockX, int a_BlockY,
}
), RepeatersDelayList.end());
- if (a_OtherChunk != NULL)
+ if (a_OtherChunk != nullptr)
{
// DO NOT touch our chunk's data structure if we are being called with coordinates from another chunk - this one caused me massive grief :P
return;
@@ -148,7 +148,7 @@ void cIncrementalRedstoneSimulator::RedstoneAddBlock(int a_BlockX, int a_BlockY,
void cIncrementalRedstoneSimulator::SimulateChunk(float a_Dt, int a_ChunkX, int a_ChunkZ, cChunk * a_Chunk)
{
m_RedstoneSimulatorChunkData = (cIncrementalRedstoneSimulator::cIncrementalRedstoneSimulatorChunkData *)a_Chunk->GetRedstoneSimulatorData();
- if (m_RedstoneSimulatorChunkData == NULL)
+ if (m_RedstoneSimulatorChunkData == nullptr)
{
m_RedstoneSimulatorChunkData = new cIncrementalRedstoneSimulator::cIncrementalRedstoneSimulatorChunkData();
a_Chunk->SetRedstoneSimulatorData(m_RedstoneSimulatorChunkData);
@@ -343,7 +343,7 @@ void cIncrementalRedstoneSimulator::HandleRedstoneTorch(int a_RelBlockX, int a_R
AddFaceDirection(X, Y, Z, GetHandlerCompileTime<E_BLOCK_TORCH>::type::MetaDataToDirection(m_Chunk->GetMeta(a_RelBlockX, a_RelBlockY, a_RelBlockZ)), true); // Inverse true to get the block torch is on
cChunk * Neighbour = m_Chunk->GetRelNeighborChunkAdjustCoords(X, Z);
- if ((Neighbour == NULL) || !Neighbour->IsValid())
+ if ((Neighbour == nullptr) || !Neighbour->IsValid())
{
return;
}
@@ -399,7 +399,7 @@ void cIncrementalRedstoneSimulator::HandleRedstoneTorch(int a_RelBlockX, int a_R
AddFaceDirection(X, Y, Z, GetHandlerCompileTime<E_BLOCK_TORCH>::type::MetaDataToDirection(m_Chunk->GetMeta(a_RelBlockX, a_RelBlockY, a_RelBlockZ)), true); // Inverse true to get the block torch is on
cChunk * Neighbour = m_Chunk->GetRelNeighborChunkAdjustCoords(X, Z);
- if ((Neighbour == NULL) || !Neighbour->IsValid())
+ if ((Neighbour == nullptr) || !Neighbour->IsValid())
{
return;
}
@@ -1050,7 +1050,7 @@ void cIncrementalRedstoneSimulator::HandlePressurePlate(int a_RelBlockX, int a_R
// MCS feature - stone pressure plates can only be triggered by players :D
cPlayer * a_Player = this->m_World.FindClosestPlayer(Vector3f(BlockX + 0.5f, (float)a_RelBlockY, BlockZ + 0.5f), 0.5f, false);
- if (a_Player != NULL)
+ if (a_Player != nullptr)
{
m_Chunk->SetMeta(a_RelBlockX, a_RelBlockY, a_RelBlockZ, 0x1);
SetAllDirsAsPowered(a_RelBlockX, a_RelBlockY, a_RelBlockZ);
@@ -1847,7 +1847,7 @@ void cIncrementalRedstoneSimulator::SetAllDirsAsPowered(int a_RelBlockX, int a_R
void cIncrementalRedstoneSimulator::SetBlockPowered(int a_RelBlockX, int a_RelBlockY, int a_RelBlockZ, int a_RelSourceX, int a_RelSourceY, int a_RelSourceZ, unsigned char a_PowerLevel)
{
cChunk * Neighbour = m_Chunk->GetRelNeighborChunkAdjustCoords(a_RelBlockX, a_RelBlockZ); // Adjust coordinates for the later call using these values
- if ((Neighbour == NULL) || !Neighbour->IsValid())
+ if ((Neighbour == nullptr) || !Neighbour->IsValid())
{
return;
}
@@ -1922,7 +1922,7 @@ void cIncrementalRedstoneSimulator::SetBlockLinkedPowered(
cChunk * Neighbour = m_Chunk->GetRelNeighborChunkAdjustCoords(a_RelBlockX, a_RelBlockZ);
m_Chunk->GetRelNeighborChunkAdjustCoords(a_RelMiddleX, a_RelMiddleZ);
- if ((Neighbour == NULL) || !Neighbour->IsValid())
+ if ((Neighbour == nullptr) || !Neighbour->IsValid())
{
return;
}
@@ -2030,7 +2030,7 @@ void cIncrementalRedstoneSimulator::SetSourceUnpowered(int a_RelSourceX, int a_R
{
if (!a_IsFirstCall) // The neighbouring chunks passed when this parameter is false may be invalid
{
- if ((a_Chunk == NULL) || !a_Chunk->IsValid())
+ if ((a_Chunk == nullptr) || !a_Chunk->IsValid())
{
return;
}
@@ -2089,7 +2089,7 @@ void cIncrementalRedstoneSimulator::SetInvalidMiddleBlock(int a_RelMiddleX, int
{
if (!a_IsFirstCall) // The neighbouring chunks passed when this parameter is false may be invalid
{
- if ((a_Chunk == NULL) || !a_Chunk->IsValid())
+ if ((a_Chunk == nullptr) || !a_Chunk->IsValid())
{
return;
}
diff --git a/src/Simulator/IncrementalRedstoneSimulator.h b/src/Simulator/IncrementalRedstoneSimulator.h
index ea6c72020..3d2962c08 100644
--- a/src/Simulator/IncrementalRedstoneSimulator.h
+++ b/src/Simulator/IncrementalRedstoneSimulator.h
@@ -108,7 +108,7 @@ private:
RepeatersDelayList * m_RepeatersDelayList;
virtual void AddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk) override { RedstoneAddBlock(a_BlockX, a_BlockY, a_BlockZ, a_Chunk); }
- void RedstoneAddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk, cChunk * a_OtherChunk = NULL);
+ void RedstoneAddBlock(int a_BlockX, int a_BlockY, int a_BlockZ, cChunk * a_Chunk, cChunk * a_OtherChunk = nullptr);
cChunk * m_Chunk;
// We want a_MyState for devices needing a full FastSetBlock (as opposed to meta) because with our simulation model, we cannot keep setting the block if it is already set correctly
@@ -390,4 +390,8 @@ private:
return RelPos;
}
-}; \ No newline at end of file
+};
+
+
+
+