1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-19 21:53:51 +00:00

Order of arguments for ContainerStore::stacks shouldn't matter. Supplying them in the correct order is error prone, and also caused a bug where equipped items would incorrectly stack.

This commit is contained in:
scrawl 2013-11-12 22:58:56 +01:00
parent 0dab7031c0
commit 700d06764c
4 changed files with 2 additions and 4 deletions

View file

@ -56,7 +56,7 @@ void InventoryItemModel::removeItem (const ItemStack& item, size_t count)
if (removed == 0)
throw std::runtime_error("Item to remove not found in container store");
else if (removed < count)
else if (removed < static_cast<int>(count))
throw std::runtime_error("Not enough items in the stack to remove");
}

View file

@ -93,7 +93,6 @@ namespace MWWorld
virtual bool stacks (const Ptr& stack, const Ptr& item);
///< @return true if the two specified objects can stack with each other
/// @note stack is the item that is already in this container
void fill (const ESM::InventoryList& items, const std::string& owner, const MWWorld::ESMStore& store);
///< Insert items into *this.

View file

@ -295,7 +295,7 @@ bool MWWorld::InventoryStore::stacks(const Ptr& stack, const Ptr& item)
for (TSlots::const_iterator iter (mSlots.begin());
iter!=mSlots.end(); ++iter)
{
if (*iter != end() && stack == **iter)
if (*iter != end() && (stack == **iter || item == **iter))
{
bool stackWhenEquipped = MWWorld::Class::get(**iter).getEquipmentSlots(**iter).second;
if (!stackWhenEquipped)

View file

@ -109,7 +109,6 @@ namespace MWWorld
virtual bool stacks (const Ptr& stack, const Ptr& item);
///< @return true if the two specified objects can stack with each other
/// @note stack is the item that is already in this container (it may be equipped)
virtual int remove(const Ptr& item, int count, const Ptr& actor);
///< Remove \a count item(s) designated by \a item from this inventory.