From: <wel...@us...> - 2010-03-13 20:19:47
|
Revision: 5675 http://planeshift.svn.sourceforge.net/planeshift/?rev=5675&view=rev Author: weltall2 Date: 2010-03-13 20:19:41 +0000 (Sat, 13 Mar 2010) Log Message: ----------- fixed PS#4033 - disappearing item patch by rlydontknow Modified Paths: -------------- trunk/src/server/bulkobjects/pscharinventory.cpp Modified: trunk/src/server/bulkobjects/pscharinventory.cpp =================================================================== --- trunk/src/server/bulkobjects/pscharinventory.cpp 2010-03-13 20:14:19 UTC (rev 5674) +++ trunk/src/server/bulkobjects/pscharinventory.cpp 2010-03-13 20:19:41 UTC (rev 5675) @@ -499,8 +499,9 @@ } // If moving inside the same container, allow it - if (item->GetContainerID() == parentItem->GetUID()) - return true; + // if (item->GetContainerID() == parentItem->GetUID()) + // return true; + // allowing this without any checking is not safe if the size of it's content or the container changed // check if the item fit in the container if(doRestrictions && @@ -672,7 +673,7 @@ if (tocheck->GetContainerID()) { - size_t size = FindItemID(tocheck->GetContainerID())->GetContainerMaxSize() - GetContainedSize(FindItemID(tocheck->GetContainerID())); + float size = FindItemID(tocheck->GetContainerID())->GetContainerMaxSize() - GetContainedSize(FindItemID(tocheck->GetContainerID())); if(size/item->GetItemSize() < fits) fits = size/item->GetItemSize(); } @@ -740,7 +741,7 @@ itemIndices = FindCompatibleStackedItems(item); for (i=0; i<itemIndices.GetSize(); i++) { - int size=0; + float size=0; if(inventory[itemIndices[i]].item->GetContainerID()){ size = GetContainedSize(FindItemID(inventory[itemIndices[i]].item->GetContainerID())); } @@ -819,7 +820,7 @@ { if (inventory[i].item->GetIsContainer()) { - int size = GetContainedSize(inventory[i].item); + float size = GetContainedSize(inventory[i].item); if (size + item->GetTotalStackSize() <= inventory[i].item->GetContainerMaxSize()) // adequate space in container { INVENTORY_SLOT_NUMBER containerSlot = (INVENTORY_SLOT_NUMBER)FindFirstOpenSlot(inventory[i].item); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |