From: <ral...@us...> - 2013-11-08 07:44:26
|
Revision: 8959 http://sourceforge.net/p/planeshift/code/8959 Author: ralphcampbell Date: 2013-11-08 07:44:23 +0000 (Fri, 08 Nov 2013) Log Message: ----------- Fix for bug 6210 - Items end up in location -1 Modified Paths: -------------- trunk/src/server/bulkobjects/pscharinventory.cpp Modified: trunk/src/server/bulkobjects/pscharinventory.cpp =================================================================== --- trunk/src/server/bulkobjects/pscharinventory.cpp 2013-11-08 06:23:11 UTC (rev 8958) +++ trunk/src/server/bulkobjects/pscharinventory.cpp 2013-11-08 07:44:23 UTC (rev 8959) @@ -482,10 +482,10 @@ bool psCharacterInventory::CheckSlotRequirements(psItem *item, INVENTORY_SLOT_NUMBER proposedSlot, unsigned short stackCount) { - CS_ASSERT(proposedSlot != PSCHARACTER_SLOT_NONE); - CS_ASSERT(item != NULL); // attempting either is probably bad + CS_ASSERT(item != NULL); - if(proposedSlot < PSCHARACTER_SLOT_NONE) + // Make sure it is a usable slot number. + if(proposedSlot < 0) return false; if (stackCount == 0) @@ -744,7 +744,6 @@ * that fails, we'll return false and possibly call this again specifying PSCHARACTER_SLOT_NONE. */ size_t i; - size_t itemIndex = SIZET_NOT_FOUND; csArray<size_t> itemIndices; @@ -782,11 +781,11 @@ } // Next check the main bulk slots - if (itemIndex == SIZET_NOT_FOUND && slot < 0) + if (slot < 0) { for (i=PSCHARACTER_SLOT_BULK1; i<PSCHARACTER_SLOT_BULK_END; i++) { - itemIndex = FindSlotIndex(NULL,(INVENTORY_SLOT_NUMBER) i ); + size_t itemIndex = FindSlotIndex(NULL,(INVENTORY_SLOT_NUMBER) i ); if (itemIndex == SIZET_NOT_FOUND) { if (test) @@ -824,11 +823,10 @@ return true; } } - itemIndex = SIZET_NOT_FOUND; } // Now try looking for a container - if (itemIndex == SIZET_NOT_FOUND && slot < 0 && !item->GetIsContainer()) + if (slot < 0 && !item->GetIsContainer()) { for (i=1; i<inventory.GetSize(); i++) { @@ -860,6 +858,7 @@ } } + // Check to see if the proposed slot is usable. if (!CheckSlotRequirements(item, slot)) return false; // -1 means add failed This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |