diff --git a/common/Item.cpp b/common/Item.cpp index b8e3c4298..e93dd5202 100644 --- a/common/Item.cpp +++ b/common/Item.cpp @@ -1053,8 +1053,7 @@ int16 Inventory::FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size, boo return SLOT_INVALID; } -void Inventory::dumpBagContents(ItemInst *inst) { - iter_inst it; +void Inventory::dumpBagContents(ItemInst *inst, iter_inst *it) { iter_contents itb; if (!inst || !inst->IsType(ItemClassContainer)) @@ -1067,7 +1066,7 @@ void Inventory::dumpBagContents(ItemInst *inst) { continue; std::string subSlot; - StringFormat(subSlot," Slot %d: %s (%d)", Inventory::CalcSlotId(it->first, itb->first), + StringFormat(subSlot," Slot %d: %s (%d)", Inventory::CalcSlotId((*it)->first, itb->first), baginst->GetItem()->Name, (baginst->GetCharges()<=0) ? 1 : baginst->GetCharges()); std::cout << subSlot << std::endl; } @@ -1089,7 +1088,7 @@ void Inventory::dumpItemCollection(const map &collection) { StringFormat(slot, "Slot %d: %s (%d)",it->first, it->second->GetItem()->Name, (inst->GetCharges()<=0) ? 1 : inst->GetCharges()); std::cout << slot << std::endl; - dumpBagContents(inst); + dumpBagContents(inst, &it); } } diff --git a/common/Item.h b/common/Item.h index 0c0ea81b9..b6703d81d 100644 --- a/common/Item.h +++ b/common/Item.h @@ -196,8 +196,6 @@ public: // Test whether a given slot can support a container item static bool SupportsContainers(int16 slot_id); - void dumpItemCollection(const map &collection); - void dumpBagContents(ItemInst *inst); void dumpEntireInventory(); void dumpWornItems(); void dumpInventory(); @@ -214,6 +212,9 @@ protected: // Protected Methods /////////////////////////////// + void dumpItemCollection(const map &collection); + void dumpBagContents(ItemInst *inst, iter_inst *it); + // Retrieves item within an inventory bucket ItemInst* _GetItem(const map& bucket, int16 slot_id) const;