summaryrefslogtreecommitdiffstats
path: root/src/BlockEntities
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-10-20 22:55:07 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-10-20 22:55:07 +0200
commit987f79afdd8945966d0dfa2d52539e005f771590 (patch)
treefa55849604121317e0a565465212032ebe4b79cb /src/BlockEntities
parentUse std::recusive_mutex (diff)
downloadcuberite-987f79afdd8945966d0dfa2d52539e005f771590.tar
cuberite-987f79afdd8945966d0dfa2d52539e005f771590.tar.gz
cuberite-987f79afdd8945966d0dfa2d52539e005f771590.tar.bz2
cuberite-987f79afdd8945966d0dfa2d52539e005f771590.tar.lz
cuberite-987f79afdd8945966d0dfa2d52539e005f771590.tar.xz
cuberite-987f79afdd8945966d0dfa2d52539e005f771590.tar.zst
cuberite-987f79afdd8945966d0dfa2d52539e005f771590.zip
Diffstat (limited to '')
-rw-r--r--src/BlockEntities/BeaconEntity.cpp10
-rw-r--r--src/BlockEntities/BlockEntity.cpp2
-rw-r--r--src/BlockEntities/BlockEntity.h4
-rw-r--r--src/BlockEntities/BlockEntityWithItems.h6
-rw-r--r--src/BlockEntities/ChestEntity.cpp6
-rw-r--r--src/BlockEntities/CommandBlockEntity.cpp2
-rw-r--r--src/BlockEntities/DispenserEntity.cpp4
-rw-r--r--src/BlockEntities/DropSpenserEntity.cpp6
-rw-r--r--src/BlockEntities/EnderChestEntity.cpp6
-rw-r--r--src/BlockEntities/FlowerPotEntity.cpp2
-rw-r--r--src/BlockEntities/FlowerPotEntity.h2
-rw-r--r--src/BlockEntities/FurnaceEntity.cpp8
-rw-r--r--src/BlockEntities/HopperEntity.cpp24
-rw-r--r--src/BlockEntities/MobHeadEntity.h2
-rw-r--r--src/BlockEntities/NoteEntity.h2
-rw-r--r--src/BlockEntities/SignEntity.h2
16 files changed, 44 insertions, 44 deletions
diff --git a/src/BlockEntities/BeaconEntity.cpp b/src/BlockEntities/BeaconEntity.cpp
index 02f45a097..85819446c 100644
--- a/src/BlockEntities/BeaconEntity.cpp
+++ b/src/BlockEntities/BeaconEntity.cpp
@@ -97,7 +97,7 @@ bool cBeaconEntity::SetPrimaryEffect(cEntityEffect::eType a_Effect)
m_PrimaryEffect = a_Effect;
// Send window update:
- if (GetWindow() != NULL)
+ if (GetWindow() != nullptr)
{
GetWindow()->SetProperty(1, m_PrimaryEffect);
}
@@ -119,7 +119,7 @@ bool cBeaconEntity::SetSecondaryEffect(cEntityEffect::eType a_Effect)
m_SecondaryEffect = a_Effect;
// Send window update:
- if (GetWindow() != NULL)
+ if (GetWindow() != nullptr)
{
GetWindow()->SetProperty(2, m_SecondaryEffect);
}
@@ -184,7 +184,7 @@ void cBeaconEntity::UpdateBeacon(void)
if (m_BeaconLevel != OldBeaconLevel)
{
// Send window update:
- if (GetWindow() != NULL)
+ if (GetWindow() != nullptr)
{
GetWindow()->SetProperty(0, m_BeaconLevel);
}
@@ -283,13 +283,13 @@ bool cBeaconEntity::Tick(float a_Dt, cChunk & a_Chunk)
void cBeaconEntity::UsedBy(cPlayer * a_Player)
{
cWindow * Window = GetWindow();
- if (Window == NULL)
+ if (Window == nullptr)
{
OpenWindow(new cBeaconWindow(m_PosX, m_PosY, m_PosZ, this));
Window = GetWindow();
}
- if (Window != NULL)
+ if (Window != nullptr)
{
// if (a_Player->GetWindow() != Window)
// -> Because mojang doesn't send a 'close window' packet when you click the cancel button in the beacon inventory ...
diff --git a/src/BlockEntities/BlockEntity.cpp b/src/BlockEntities/BlockEntity.cpp
index 05ad03a3d..3d96e891e 100644
--- a/src/BlockEntities/BlockEntity.cpp
+++ b/src/BlockEntities/BlockEntity.cpp
@@ -48,7 +48,7 @@ cBlockEntity * cBlockEntity::CreateByBlockType(BLOCKTYPE a_BlockType, NIBBLETYPE
__FUNCTION__, a_BlockType, ItemTypeToString(a_BlockType).c_str()
);
ASSERT(!"Requesting creation of an unknown block entity");
- return NULL;
+ return nullptr;
}
diff --git a/src/BlockEntities/BlockEntity.h b/src/BlockEntities/BlockEntity.h
index b04d20340..ffd6ee856 100644
--- a/src/BlockEntities/BlockEntity.h
+++ b/src/BlockEntities/BlockEntity.h
@@ -70,8 +70,8 @@ public:
/// Creates a new block entity for the specified block type
/// If a_World is valid, then the entity is created bound to that world
- /// Returns NULL for unknown block types
- static cBlockEntity * CreateByBlockType(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World = NULL);
+ /// Returns nullptr for unknown block types
+ static cBlockEntity * CreateByBlockType(BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World = nullptr);
static const char * GetClassStatic(void) // Needed for ManualBindings's ForEach templates
{
diff --git a/src/BlockEntities/BlockEntityWithItems.h b/src/BlockEntities/BlockEntityWithItems.h
index cb7bc2fb4..8c7d4749b 100644
--- a/src/BlockEntities/BlockEntityWithItems.h
+++ b/src/BlockEntities/BlockEntityWithItems.h
@@ -47,7 +47,7 @@ public:
virtual void Destroy(void) override
{
// Drop the contents as pickups:
- ASSERT(m_World != NULL);
+ ASSERT(m_World != nullptr);
cItems Pickups;
m_Contents.CopyToItems(Pickups);
m_Contents.Clear();
@@ -78,9 +78,9 @@ protected:
{
UNUSED(a_SlotNum);
ASSERT(a_Grid == &m_Contents);
- if (m_World != NULL)
+ if (m_World != nullptr)
{
- if (GetWindow() != NULL)
+ if (GetWindow() != nullptr)
{
GetWindow()->BroadcastWholeWindow();
}
diff --git a/src/BlockEntities/ChestEntity.cpp b/src/BlockEntities/ChestEntity.cpp
index 19d88b646..0cd9c66e0 100644
--- a/src/BlockEntities/ChestEntity.cpp
+++ b/src/BlockEntities/ChestEntity.cpp
@@ -23,7 +23,7 @@ cChestEntity::cChestEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_
cChestEntity::~cChestEntity()
{
cWindow * Window = GetWindow();
- if (Window != NULL)
+ if (Window != nullptr)
{
Window->OwnerDestroyed();
}
@@ -49,14 +49,14 @@ void cChestEntity::UsedBy(cPlayer * a_Player)
{
// If the window is not created, open it anew:
cWindow * Window = GetWindow();
- if (Window == NULL)
+ if (Window == nullptr)
{
OpenNewWindow();
Window = GetWindow();
}
// Open the window for the player:
- if (Window != NULL)
+ if (Window != nullptr)
{
if (a_Player->GetWindow() != Window)
{
diff --git a/src/BlockEntities/CommandBlockEntity.cpp b/src/BlockEntities/CommandBlockEntity.cpp
index 1a5a3f01e..b7f938ffd 100644
--- a/src/BlockEntities/CommandBlockEntity.cpp
+++ b/src/BlockEntities/CommandBlockEntity.cpp
@@ -154,7 +154,7 @@ void cCommandBlockEntity::SendTo(cClientHandle & a_Client)
void cCommandBlockEntity::Execute()
{
- ASSERT(m_World != NULL); // Execute should not be called before the command block is attached to a world
+ ASSERT(m_World != nullptr); // Execute should not be called before the command block is attached to a world
if (!m_World->AreCommandBlocksEnabled())
{
diff --git a/src/BlockEntities/DispenserEntity.cpp b/src/BlockEntities/DispenserEntity.cpp
index aea854dc2..82c234a14 100644
--- a/src/BlockEntities/DispenserEntity.cpp
+++ b/src/BlockEntities/DispenserEntity.cpp
@@ -28,7 +28,7 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum)
NIBBLETYPE Meta = a_Chunk.GetMeta(m_RelX, m_PosY, m_RelZ);
AddDropSpenserDir(DispX, DispY, DispZ, Meta);
cChunk * DispChunk = a_Chunk.GetRelNeighborChunkAdjustCoords(DispX, DispZ);
- if (DispChunk == NULL)
+ if (DispChunk == nullptr)
{
// Would dispense into / interact with a non-loaded chunk, ignore the tick
return;
@@ -190,7 +190,7 @@ void cDispenserEntity::DropSpenseFromSlot(cChunk & a_Chunk, int a_SlotNum)
void cDispenserEntity::SpawnProjectileFromDispenser(int a_BlockX, int a_BlockY, int a_BlockZ, cProjectileEntity::eKind a_Kind, const Vector3d & a_ShootVector)
{
- m_World->CreateProjectile((double)a_BlockX + 0.5, (double)a_BlockY + 0.5, (double)a_BlockZ + 0.5, a_Kind, NULL, NULL, &a_ShootVector);
+ m_World->CreateProjectile((double)a_BlockX + 0.5, (double)a_BlockY + 0.5, (double)a_BlockZ + 0.5, a_Kind, nullptr, nullptr, &a_ShootVector);
}
diff --git a/src/BlockEntities/DropSpenserEntity.cpp b/src/BlockEntities/DropSpenserEntity.cpp
index dac951b27..3f98836e7 100644
--- a/src/BlockEntities/DropSpenserEntity.cpp
+++ b/src/BlockEntities/DropSpenserEntity.cpp
@@ -28,7 +28,7 @@ cDropSpenserEntity::~cDropSpenserEntity()
{
// Tell window its owner is destroyed
cWindow * Window = GetWindow();
- if (Window != NULL)
+ if (Window != nullptr)
{
Window->OwnerDestroyed();
}
@@ -155,13 +155,13 @@ void cDropSpenserEntity::SendTo(cClientHandle & a_Client)
void cDropSpenserEntity::UsedBy(cPlayer * a_Player)
{
cWindow * Window = GetWindow();
- if (Window == NULL)
+ if (Window == nullptr)
{
OpenWindow(new cDropSpenserWindow(m_PosX, m_PosY, m_PosZ, this));
Window = GetWindow();
}
- if (Window != NULL)
+ if (Window != nullptr)
{
if (a_Player->GetWindow() != Window)
{
diff --git a/src/BlockEntities/EnderChestEntity.cpp b/src/BlockEntities/EnderChestEntity.cpp
index 0654d97dd..e18490a1e 100644
--- a/src/BlockEntities/EnderChestEntity.cpp
+++ b/src/BlockEntities/EnderChestEntity.cpp
@@ -23,7 +23,7 @@ cEnderChestEntity::cEnderChestEntity(int a_BlockX, int a_BlockY, int a_BlockZ, c
cEnderChestEntity::~cEnderChestEntity()
{
cWindow * Window = GetWindow();
- if (Window != NULL)
+ if (Window != nullptr)
{
Window->OwnerDestroyed();
}
@@ -37,14 +37,14 @@ void cEnderChestEntity::UsedBy(cPlayer * a_Player)
{
// If the window is not created, open it anew:
cWindow * Window = GetWindow();
- if (Window == NULL)
+ if (Window == nullptr)
{
OpenNewWindow();
Window = GetWindow();
}
// Open the window for the player:
- if (Window != NULL)
+ if (Window != nullptr)
{
if (a_Player->GetWindow() != Window)
{
diff --git a/src/BlockEntities/FlowerPotEntity.cpp b/src/BlockEntities/FlowerPotEntity.cpp
index 01560f814..9db3b268b 100644
--- a/src/BlockEntities/FlowerPotEntity.cpp
+++ b/src/BlockEntities/FlowerPotEntity.cpp
@@ -59,7 +59,7 @@ void cFlowerPotEntity::Destroy(void)
// Drop the contents as pickups:
if (!m_Item.IsEmpty())
{
- ASSERT(m_World != NULL);
+ ASSERT(m_World != nullptr);
cItems Pickups;
Pickups.Add(m_Item);
m_World->SpawnItemPickups(Pickups, m_PosX + 0.5, m_PosY + 0.5, m_PosZ + 0.5);
diff --git a/src/BlockEntities/FlowerPotEntity.h b/src/BlockEntities/FlowerPotEntity.h
index 5b86621f5..fc886c51f 100644
--- a/src/BlockEntities/FlowerPotEntity.h
+++ b/src/BlockEntities/FlowerPotEntity.h
@@ -38,7 +38,7 @@ public:
BLOCKENTITY_PROTODEF(cFlowerPotEntity);
- /** Creates a new flowerpot entity at the specified block coords. a_World may be NULL */
+ /** Creates a new flowerpot entity at the specified block coords. a_World may be nullptr */
cFlowerPotEntity(int a_BlocX, int a_BlockY, int a_BlockZ, cWorld * a_World);
virtual void Destroy(void) override;
diff --git a/src/BlockEntities/FurnaceEntity.cpp b/src/BlockEntities/FurnaceEntity.cpp
index 284ac7de9..85f68b00b 100644
--- a/src/BlockEntities/FurnaceEntity.cpp
+++ b/src/BlockEntities/FurnaceEntity.cpp
@@ -26,7 +26,7 @@ enum
cFurnaceEntity::cFurnaceEntity(int a_BlockX, int a_BlockY, int a_BlockZ, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta, cWorld * a_World) :
super(a_BlockType, a_BlockX, a_BlockY, a_BlockZ, ContentsWidth, ContentsHeight, a_World),
m_BlockMeta(a_BlockMeta),
- m_CurrentRecipe(NULL),
+ m_CurrentRecipe(nullptr),
m_IsDestroyed(false),
m_IsCooking(a_BlockType == E_BLOCK_LIT_FURNACE),
m_NeedCookTime(0),
@@ -45,7 +45,7 @@ cFurnaceEntity::~cFurnaceEntity()
{
// Tell window its owner is destroyed
cWindow * Window = GetWindow();
- if (Window != NULL)
+ if (Window != nullptr)
{
Window->OwnerDestroyed();
}
@@ -145,7 +145,7 @@ void cFurnaceEntity::SendTo(cClientHandle & a_Client)
void cFurnaceEntity::BroadcastProgress(short a_ProgressbarID, short a_Value)
{
cWindow * Window = GetWindow();
- if (Window != NULL)
+ if (Window != nullptr)
{
Window->SetProperty(a_ProgressbarID, a_Value);
}
@@ -306,7 +306,7 @@ void cFurnaceEntity::UpdateOutput(void)
bool cFurnaceEntity::CanCookInputToOutput(void) const
{
- if (m_CurrentRecipe == NULL)
+ if (m_CurrentRecipe == nullptr)
{
// This input cannot be cooked
return false;
diff --git a/src/BlockEntities/HopperEntity.cpp b/src/BlockEntities/HopperEntity.cpp
index 103f516fc..5ed25ce99 100644
--- a/src/BlockEntities/HopperEntity.cpp
+++ b/src/BlockEntities/HopperEntity.cpp
@@ -86,14 +86,14 @@ void cHopperEntity::UsedBy(cPlayer * a_Player)
{
// If the window is not created, open it anew:
cWindow * Window = GetWindow();
- if (Window == NULL)
+ if (Window == nullptr)
{
OpenNewWindow();
Window = GetWindow();
}
// Open the window for the player:
- if (Window != NULL)
+ if (Window != nullptr)
{
if (a_Player->GetWindow() != Window)
{
@@ -197,7 +197,7 @@ bool cHopperEntity::MovePickupsIn(cChunk & a_Chunk, Int64 a_CurrentTick)
virtual bool Item(cEntity * a_Entity) override
{
- ASSERT(a_Entity != NULL);
+ ASSERT(a_Entity != nullptr);
if (!a_Entity->IsPickup() || a_Entity->IsDestroyed())
{
@@ -299,7 +299,7 @@ bool cHopperEntity::MoveItemsOut(cChunk & a_Chunk, Int64 a_CurrentTick)
int OutRelX = OutX - a_Chunk.GetPosX() * cChunkDef::Width;
int OutRelZ = OutZ - a_Chunk.GetPosZ() * cChunkDef::Width;
cChunk * DestChunk = a_Chunk.GetRelNeighborChunkAdjustCoords(OutRelX, OutRelZ);
- if (DestChunk == NULL)
+ if (DestChunk == nullptr)
{
// The destination chunk has been unloaded, don't tick
return false;
@@ -328,7 +328,7 @@ bool cHopperEntity::MoveItemsOut(cChunk & a_Chunk, Int64 a_CurrentTick)
case E_BLOCK_HOPPER:
{
cBlockEntityWithItems * BlockEntity = (cBlockEntityWithItems *)DestChunk->GetBlockEntity(OutX, OutY, OutZ);
- if (BlockEntity == NULL)
+ if (BlockEntity == nullptr)
{
LOGWARNING("%s: A block entity was not found where expected at {%d, %d, %d}", __FUNCTION__, OutX, OutY, OutZ);
return false;
@@ -355,7 +355,7 @@ bool cHopperEntity::MoveItemsOut(cChunk & a_Chunk, Int64 a_CurrentTick)
bool cHopperEntity::MoveItemsFromChest(cChunk & a_Chunk)
{
cChestEntity * MainChest = (cChestEntity *)a_Chunk.GetBlockEntity(m_PosX, m_PosY + 1, m_PosZ);
- if (MainChest == NULL)
+ if (MainChest == nullptr)
{
LOGWARNING("%s: A chest entity was not found where expected, at {%d, %d, %d}", __FUNCTION__, m_PosX, m_PosY + 1, m_PosZ);
return false;
@@ -383,7 +383,7 @@ bool cHopperEntity::MoveItemsFromChest(cChunk & a_Chunk)
int x = m_RelX + Coords[i].x;
int z = m_RelZ + Coords[i].z;
cChunk * Neighbor = a_Chunk.GetRelNeighborChunkAdjustCoords(x, z);
- if (Neighbor == NULL)
+ if (Neighbor == nullptr)
{
continue;
}
@@ -396,7 +396,7 @@ bool cHopperEntity::MoveItemsFromChest(cChunk & a_Chunk)
}
cChestEntity * SideChest = (cChestEntity *)Neighbor->GetBlockEntity(m_PosX + Coords[i].x, m_PosY + 1, m_PosZ + Coords[i].z);
- if (SideChest == NULL)
+ if (SideChest == nullptr)
{
LOGWARNING("%s: A chest entity was not found where expected, at {%d, %d, %d}", __FUNCTION__, m_PosX + Coords[i].x, m_PosY + 1, m_PosZ + Coords[i].z);
}
@@ -422,7 +422,7 @@ bool cHopperEntity::MoveItemsFromChest(cChunk & a_Chunk)
bool cHopperEntity::MoveItemsFromFurnace(cChunk & a_Chunk)
{
cFurnaceEntity * Furnace = (cFurnaceEntity *)a_Chunk.GetBlockEntity(m_PosX, m_PosY + 1, m_PosZ);
- if (Furnace == NULL)
+ if (Furnace == nullptr)
{
LOGWARNING("%s: A furnace entity was not found where expected, at {%d, %d, %d}", __FUNCTION__, m_PosX, m_PosY + 1, m_PosZ);
return false;
@@ -536,7 +536,7 @@ bool cHopperEntity::MoveItemsToChest(cChunk & a_Chunk, int a_BlockX, int a_Block
{
// Try the chest directly connected to the hopper:
cChestEntity * ConnectedChest = (cChestEntity *)a_Chunk.GetBlockEntity(a_BlockX, a_BlockY, a_BlockZ);
- if (ConnectedChest == NULL)
+ if (ConnectedChest == nullptr)
{
LOGWARNING("%s: A chest entity was not found where expected, at {%d, %d, %d}", __FUNCTION__, a_BlockX, a_BlockY, a_BlockZ);
return false;
@@ -566,7 +566,7 @@ bool cHopperEntity::MoveItemsToChest(cChunk & a_Chunk, int a_BlockX, int a_Block
int x = RelX + Coords[i].x;
int z = RelZ + Coords[i].z;
cChunk * Neighbor = a_Chunk.GetRelNeighborChunkAdjustCoords(x, z);
- if (Neighbor == NULL)
+ if (Neighbor == nullptr)
{
continue;
}
@@ -579,7 +579,7 @@ bool cHopperEntity::MoveItemsToChest(cChunk & a_Chunk, int a_BlockX, int a_Block
}
cChestEntity * Chest = (cChestEntity *)Neighbor->GetBlockEntity(a_BlockX + Coords[i].x, a_BlockY, a_BlockZ + Coords[i].z);
- if (Chest == NULL)
+ if (Chest == nullptr)
{
LOGWARNING("%s: A chest entity was not found where expected, at {%d, %d, %d} (%d, %d)", __FUNCTION__, a_BlockX + Coords[i].x, a_BlockY, a_BlockZ + Coords[i].z, x, z);
continue;
diff --git a/src/BlockEntities/MobHeadEntity.h b/src/BlockEntities/MobHeadEntity.h
index 7f69bc5ad..7132ef558 100644
--- a/src/BlockEntities/MobHeadEntity.h
+++ b/src/BlockEntities/MobHeadEntity.h
@@ -36,7 +36,7 @@ public:
BLOCKENTITY_PROTODEF(cMobHeadEntity);
- /** Creates a new mob head entity at the specified block coords. a_World may be NULL */
+ /** Creates a new mob head entity at the specified block coords. a_World may be nullptr */
cMobHeadEntity(int a_BlockX, int a_BlockY, int a_BlockZ, cWorld * a_World);
// tolua_begin
diff --git a/src/BlockEntities/NoteEntity.h b/src/BlockEntities/NoteEntity.h
index 74dbde046..fc5f27d07 100644
--- a/src/BlockEntities/NoteEntity.h
+++ b/src/BlockEntities/NoteEntity.h
@@ -42,7 +42,7 @@ public:
BLOCKENTITY_PROTODEF(cNoteEntity);
- /// Creates a new note entity. a_World may be NULL
+ /// Creates a new note entity. a_World may be nullptr
cNoteEntity(int a_X, int a_Y, int a_Z, cWorld * a_World);
virtual ~cNoteEntity() {}
diff --git a/src/BlockEntities/SignEntity.h b/src/BlockEntities/SignEntity.h
index be13c7a32..52baa486d 100644
--- a/src/BlockEntities/SignEntity.h
+++ b/src/BlockEntities/SignEntity.h
@@ -36,7 +36,7 @@ public:
BLOCKENTITY_PROTODEF(cSignEntity);
- /// Creates a new empty sign entity at the specified block coords and block type (wall or standing). a_World may be NULL
+ /// Creates a new empty sign entity at the specified block coords and block type (wall or standing). a_World may be nullptr
cSignEntity(BLOCKTYPE a_BlockType, int a_X, int a_Y, int a_Z, cWorld * a_World);
// tolua_begin