Merge remote branch 'scrawl/itemstacking'

actorid
Marc Zinnschlag 13 years ago
commit 2bf12a4839

@ -45,7 +45,7 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::end()
return ContainerStoreIterator (this);
}
bool MWWorld::ContainerStore::stacks(const Ptr& ptr1, const Ptr& ptr2) const
bool MWWorld::ContainerStore::stacks(const Ptr& ptr1, const Ptr& ptr2)
{
/// \todo add current weapon/armor health, remaining lockpick/repair uses, current enchantment charge here as soon as they are implemented
if ( ptr1.mCellRef->refID == ptr2.mCellRef->refID

@ -78,7 +78,7 @@ namespace MWWorld
void addImpl (const Ptr& ptr);
///< Add the item to this container (no stacking)
virtual bool stacks (const Ptr& ptr1, const Ptr& ptr2) const;
virtual bool stacks (const Ptr& ptr1, const Ptr& ptr2);
///< @return true if the two specified objects can stack with each other
/// @note ptr1 is the item that is already in this container

@ -201,7 +201,7 @@ void MWWorld::InventoryStore::autoEquip (const MWMechanics::NpcStats& stats)
}
}
bool MWWorld::InventoryStore::stacks(const Ptr& ptr1, const Ptr& ptr2) const
bool MWWorld::InventoryStore::stacks(const Ptr& ptr1, const Ptr& ptr2)
{
bool canStack = MWWorld::ContainerStore::stacks(ptr1, ptr2);
if (!canStack)
@ -211,7 +211,7 @@ bool MWWorld::InventoryStore::stacks(const Ptr& ptr1, const Ptr& ptr2) const
for (TSlots::const_iterator iter (mSlots.begin());
iter!=mSlots.end(); ++iter)
{
if (ptr1 == **iter)
if (*iter != end() && ptr1 == **iter)
return false;
}

@ -67,7 +67,7 @@ namespace MWWorld
protected:
virtual bool stacks (const Ptr& ptr1, const Ptr& ptr2) const;
virtual bool stacks (const Ptr& ptr1, const Ptr& ptr2);
///< @return true if the two specified objects can stack with each other
/// @note ptr1 is the item that is already in this container

Loading…
Cancel
Save