using this [Hidden Content]
marty 5.8,
if i try to use faststack to stack a item in belt inventory it causes the core to crash.
how i include the beltinventory?
#ifdef FAST_ITEM_AUTOSTACK
bool CHARACTER::FastStack(TItemPos originPos)
{
if (!IsValidItemPosition(originPos))
return false;
if (!CanHandleItem())
return false;
LPITEM item = GetItem(originPos);
if (item == nullptr)
return false;
if (item->GetCount() >= ITEM_MAX_COUNT)
{
ChatPacket(CHAT_TYPE_INFO, "ITEM MAX");
return false;
}
int currentPos = originPos.cell + 1;
while (item->GetCount() < ITEM_MAX_COUNT && (originPos.cell != currentPos))
{
LPITEM item2 = GetInventoryItem(currentPos);
if (item2)
{
if (item2->GetVnum() == item->GetVnum())
{
if (item2->GetCount() < ITEM_MAX_COUNT)
{
int itemCount = item->GetCount();
int item2Count = item2->GetCount();
if (itemCount + item2Count > ITEM_MAX_COUNT)
{
int requiredCountToMax = (ITEM_MAX_COUNT - itemCount);
MoveItem(TItemPos(INVENTORY, item2->GetCell()), originPos, requiredCountToMax);
}
else
{
MoveItem(TItemPos(INVENTORY, item2->GetCell()), originPos, item2->GetCount());
}
}
}
}
currentPos++;
if (currentPos >= ITEM_MAX_COUNT)
{
currentPos = 0;
}
}
return true;
}
#endif