summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-06-24 15:27:19 +0200
committerHowaner <franzi.moos@googlemail.com>2014-06-24 15:27:19 +0200
commit5ab01c4d4205b61b41855eaeee534ae15b816331 (patch)
tree5e027c16e4f2843e299d1f5d0d54f0eb12b02644
parentFixed BlockInfo initialization. (diff)
downloadcuberite-5ab01c4d4205b61b41855eaeee534ae15b816331.tar
cuberite-5ab01c4d4205b61b41855eaeee534ae15b816331.tar.gz
cuberite-5ab01c4d4205b61b41855eaeee534ae15b816331.tar.bz2
cuberite-5ab01c4d4205b61b41855eaeee534ae15b816331.tar.lz
cuberite-5ab01c4d4205b61b41855eaeee534ae15b816331.tar.xz
cuberite-5ab01c4d4205b61b41855eaeee534ae15b816331.tar.zst
cuberite-5ab01c4d4205b61b41855eaeee534ae15b816331.zip
Diffstat (limited to '')
-rw-r--r--src/Entities/Pickup.cpp12
-rw-r--r--src/Item.cpp2
2 files changed, 9 insertions, 5 deletions
diff --git a/src/Entities/Pickup.cpp b/src/Entities/Pickup.cpp
index 0fd006485..88d961106 100644
--- a/src/Entities/Pickup.cpp
+++ b/src/Entities/Pickup.cpp
@@ -38,11 +38,15 @@ public:
Vector3d EntityPos = a_Entity->GetPosition();
double Distance = (EntityPos - m_Position).Length();
- if ((Distance < 1.2) && ((cPickup *)a_Entity)->GetItem().IsEqual(m_Pickup->GetItem()))
+ cItem & Item = ((cPickup *)a_Entity)->GetItem();
+ if ((Distance < 1.2) && Item.IsEqual(m_Pickup->GetItem()))
{
- m_Pickup->GetItem().AddCount(((cPickup *)a_Entity)->GetItem().m_ItemCount);
- a_Entity->Destroy();
- m_FoundMatchingPickup = true;
+ if ((Item.m_ItemCount + m_Pickup->GetItem().m_ItemCount) <= Item.GetMaxStackSize())
+ {
+ m_Pickup->GetItem().AddCount(Item.m_ItemCount);
+ a_Entity->Destroy();
+ m_FoundMatchingPickup = true;
+ }
}
return false;
}
diff --git a/src/Item.cpp b/src/Item.cpp
index d6e8b224a..56ceae0b7 100644
--- a/src/Item.cpp
+++ b/src/Item.cpp
@@ -1,4 +1,4 @@
-
+
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
#include "Item.h"