summaryrefslogtreecommitdiffstats
path: root/src/BlockEntities/DropSpenserEntity.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/BlockEntities/DropSpenserEntity.cpp')
-rw-r--r--src/BlockEntities/DropSpenserEntity.cpp22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/BlockEntities/DropSpenserEntity.cpp b/src/BlockEntities/DropSpenserEntity.cpp
index e39b938a0..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();
}
@@ -70,19 +70,19 @@ void cDropSpenserEntity::DropSpense(cChunk & a_Chunk)
SlotsCnt++;
}
} // for i - m_Contents[]
-
+
if (SlotsCnt == 0)
{
// Nothing in the dropspenser, play the click sound
m_World->BroadcastSoundEffect("random.click", m_PosX * 8, m_PosY * 8, m_PosZ * 8, 1.0f, 1.2f);
return;
}
-
+
int RandomSlot = m_World->GetTickRandomNumber(SlotsCnt - 1);
-
+
// DropSpense the item, using the specialized behavior in the subclasses:
DropSpenseFromSlot(a_Chunk, OccupiedSlots[RandomSlot]);
-
+
// Broadcast a smoke and click effects:
NIBBLETYPE Meta = a_Chunk.GetMeta(m_RelX, m_PosY, m_RelZ);
int SmokeDir = 0;
@@ -132,7 +132,7 @@ bool cDropSpenserEntity::Tick(float a_Dt, cChunk & a_Chunk)
{
return false;
}
-
+
m_ShouldDropSpense = false;
DropSpense(a_Chunk);
return true;
@@ -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)
{
@@ -205,3 +205,7 @@ void cDropSpenserEntity::DropFromSlot(cChunk & a_Chunk, int a_SlotNum)
m_World->SpawnItemPickups(Pickups, MicroX, MicroY, MicroZ, PickupSpeedX, PickupSpeedY, PickupSpeedZ);
}
+
+
+
+