mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-13 15:09:43 +00:00
make sure iterator is not end() before trying to get the equipped item
This commit is contained in:
parent
d341d2113c
commit
82b9f835b1
4 changed files with 5 additions and 5 deletions
|
@ -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…
Reference in a new issue