Fix pickup combining over the maximum stack size.
This commit is contained in:
parent
a1d2c114cf
commit
5ab01c4d42
|
@ -38,11 +38,15 @@ public:
|
||||||
Vector3d EntityPos = a_Entity->GetPosition();
|
Vector3d EntityPos = a_Entity->GetPosition();
|
||||||
double Distance = (EntityPos - m_Position).Length();
|
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);
|
if ((Item.m_ItemCount + m_Pickup->GetItem().m_ItemCount) <= Item.GetMaxStackSize())
|
||||||
a_Entity->Destroy();
|
{
|
||||||
m_FoundMatchingPickup = true;
|
m_Pickup->GetItem().AddCount(Item.m_ItemCount);
|
||||||
|
a_Entity->Destroy();
|
||||||
|
m_FoundMatchingPickup = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
|
|
||||||
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
|
#include "Globals.h" // NOTE: MSVC stupidness requires this to be the same across all modules
|
||||||
|
|
||||||
#include "Item.h"
|
#include "Item.h"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user