Fix for stackable items being unmoveable when charges=0

This commit is contained in:
Leere 2014-12-17 00:24:47 +01:00
parent ad8e834fe8
commit 7d39ea59e8

View File

@ -565,6 +565,8 @@ bool SharedDatabase::GetInventory(uint32 char_id, Inventory* inv) {
if(charges==0x7FFF)
inst->SetCharges(-1);
else if (charges == 0 && inst->IsStackable()) // Stackable items need a minimum charge of 1 remain moveable.
inst->SetCharges(1);
else
inst->SetCharges(charges);
@ -1234,6 +1236,9 @@ ItemInst* SharedDatabase::CreateBaseItem(const Item_Struct* item, int16 charges)
// set it to 1 charge so that it is usable on creation
if (charges == 0 && item->MaxCharges == -1)
charges = 1;
// Stackable items need a minimum charge of 1 to remain moveable.
if(charges <= 0 && item->Stackable)
charges = 1;
inst = new ItemInst(item, charges);