summaryrefslogtreecommitdiffstats
path: root/source/Pickup.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-12-28 03:45:20 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-12-28 03:45:20 +0100
commit0cc3ab7c1ee21ea35ebe3ff17f641477dd34f9ec (patch)
tree4d421bba734bb56e7021b170f94f11a3daa54158 /source/Pickup.cpp
parentFixed OnBlockPlace hook (diff)
downloadcuberite-0cc3ab7c1ee21ea35ebe3ff17f641477dd34f9ec.tar
cuberite-0cc3ab7c1ee21ea35ebe3ff17f641477dd34f9ec.tar.gz
cuberite-0cc3ab7c1ee21ea35ebe3ff17f641477dd34f9ec.tar.bz2
cuberite-0cc3ab7c1ee21ea35ebe3ff17f641477dd34f9ec.tar.lz
cuberite-0cc3ab7c1ee21ea35ebe3ff17f641477dd34f9ec.tar.xz
cuberite-0cc3ab7c1ee21ea35ebe3ff17f641477dd34f9ec.tar.zst
cuberite-0cc3ab7c1ee21ea35ebe3ff17f641477dd34f9ec.zip
Diffstat (limited to 'source/Pickup.cpp')
-rw-r--r--source/Pickup.cpp21
1 files changed, 6 insertions, 15 deletions
diff --git a/source/Pickup.cpp b/source/Pickup.cpp
index f147434ab..b2290ab73 100644
--- a/source/Pickup.cpp
+++ b/source/Pickup.cpp
@@ -24,13 +24,13 @@
-cPickup::cPickup(int a_X, int a_Y, int a_Z, const cItem & a_Item, float a_SpeedX /* = 0.f */, float a_SpeedY /* = 0.f */, float a_SpeedZ /* = 0.f */)
- : cEntity(etPickup, ((double)(a_X))/32, ((double)(a_Y))/32, ((double)(a_Z))/32 )
+cPickup::cPickup(int a_MicroPosX, int a_MicroPosY, int a_MicroPosZ, const cItem & a_Item, float a_SpeedX /* = 0.f */, float a_SpeedY /* = 0.f */, float a_SpeedZ /* = 0.f */)
+ : cEntity(etPickup, ((double)(a_MicroPosX)) / 32, ((double)(a_MicroPosY)) / 32, ((double)(a_MicroPosZ)) / 32)
, m_Speed( a_SpeedX, a_SpeedY, a_SpeedZ )
, m_bOnGround( false )
, m_bReplicated( false )
, m_Timer( 0.f )
- , m_Item( new cItem( a_Item ) )
+ , m_Item(a_Item)
, m_bCollected( false )
{
}
@@ -39,15 +39,6 @@ cPickup::cPickup(int a_X, int a_Y, int a_Z, const cItem & a_Item, float a_SpeedX
-cPickup::~cPickup()
-{
- delete m_Item;
-}
-
-
-
-
-
void cPickup::Initialize(cWorld * a_World)
{
super::Initialize(a_World);
@@ -244,15 +235,15 @@ bool cPickup::CollectedBy(cPlayer * a_Dest)
return false;
}
- if (a_Dest->GetInventory().AddItemAnyAmount(*m_Item))
+ if (a_Dest->GetInventory().AddItemAnyAmount(m_Item))
{
m_World->BroadcastCollectPickup(*this, *a_Dest);
m_bCollected = true;
m_Timer = 0;
- if (m_Item->m_ItemCount != 0)
+ if (m_Item.m_ItemCount != 0)
{
cItems Pickup;
- Pickup.push_back(cItem(*m_Item));
+ Pickup.push_back(cItem(m_Item));
m_World->SpawnItemPickups(Pickup, m_Pos.x, m_Pos.y, m_Pos.z);
}
return true;