summaryrefslogtreecommitdiffstats
path: root/source/Pickup.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-05-24 09:30:39 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-05-24 09:30:39 +0200
commitcf87169737fdeeee7d4b160688bbed7194e46147 (patch)
tree7daaeb9af8e3187cde6068c3cff5ff0ee64f0067 /source/Pickup.cpp
parentAdded ItemCategory::IsArmor() (diff)
downloadcuberite-cf87169737fdeeee7d4b160688bbed7194e46147.tar
cuberite-cf87169737fdeeee7d4b160688bbed7194e46147.tar.gz
cuberite-cf87169737fdeeee7d4b160688bbed7194e46147.tar.bz2
cuberite-cf87169737fdeeee7d4b160688bbed7194e46147.tar.lz
cuberite-cf87169737fdeeee7d4b160688bbed7194e46147.tar.xz
cuberite-cf87169737fdeeee7d4b160688bbed7194e46147.tar.zst
cuberite-cf87169737fdeeee7d4b160688bbed7194e46147.zip
Diffstat (limited to 'source/Pickup.cpp')
-rw-r--r--source/Pickup.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/source/Pickup.cpp b/source/Pickup.cpp
index bf48daf82..19959efa3 100644
--- a/source/Pickup.cpp
+++ b/source/Pickup.cpp
@@ -149,17 +149,17 @@ bool cPickup::CollectedBy(cPlayer * a_Dest)
return false;
}
- if (a_Dest->GetInventory().AddItemAnyAmount(m_Item))
+ int NumAdded = a_Dest->GetInventory().AddItem(m_Item);
+ if (NumAdded > 0)
{
+ m_Item.m_ItemCount -= NumAdded;
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));
- m_World->SpawnItemPickups(Pickup, GetPosX(), GetPosY(), GetPosZ());
+ // All of the pickup has been collected, schedule the pickup for destroying
+ m_bCollected = true;
}
+ m_Timer = 0;
return true;
}