forked from mirror/openmw-tes3mp
Accept a ConstPtr in ContainerStore::stacks
This commit is contained in:
parent
04f7a8f8eb
commit
edde5bd065
5 changed files with 34 additions and 4 deletions
|
@ -176,7 +176,7 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::restack(const MWWorld::
|
|||
return retval;
|
||||
}
|
||||
|
||||
bool MWWorld::ContainerStore::stacks(const Ptr& ptr1, const Ptr& ptr2)
|
||||
bool MWWorld::ContainerStore::stacks(const ConstPtr& ptr1, const ConstPtr& ptr2)
|
||||
{
|
||||
const MWWorld::Class& cls1 = ptr1.getClass();
|
||||
const MWWorld::Class& cls2 = ptr2.getClass();
|
||||
|
|
|
@ -149,7 +149,7 @@ namespace MWWorld
|
|||
|
||||
public:
|
||||
|
||||
virtual bool stacks (const Ptr& ptr1, const Ptr& ptr2);
|
||||
virtual bool stacks (const ConstPtr& ptr1, const ConstPtr& ptr2);
|
||||
///< @return true if the two specified objects can stack with each other
|
||||
|
||||
void fill (const ESM::InventoryList& items, const std::string& owner);
|
||||
|
|
|
@ -450,7 +450,7 @@ void MWWorld::InventoryStore::flagAsModified()
|
|||
mRechargingItemsUpToDate = false;
|
||||
}
|
||||
|
||||
bool MWWorld::InventoryStore::stacks(const Ptr& ptr1, const Ptr& ptr2)
|
||||
bool MWWorld::InventoryStore::stacks(const ConstPtr& ptr1, const ConstPtr& ptr2)
|
||||
{
|
||||
bool canStack = MWWorld::ContainerStore::stacks(ptr1, ptr2);
|
||||
if (!canStack)
|
||||
|
|
|
@ -167,7 +167,7 @@ namespace MWWorld
|
|||
///< \attention This function is internal to the world model and should not be called from
|
||||
/// outside.
|
||||
|
||||
virtual bool stacks (const Ptr& ptr1, const Ptr& ptr2);
|
||||
virtual bool stacks (const ConstPtr& ptr1, const ConstPtr& ptr2);
|
||||
///< @return true if the two specified objects can stack with each other
|
||||
|
||||
virtual int remove(const Ptr& item, int count, const Ptr& actor);
|
||||
|
|
|
@ -195,6 +195,36 @@ namespace MWWorld
|
|||
{
|
||||
return !(left>right);
|
||||
}
|
||||
|
||||
inline bool operator== (const ConstPtr& left, const ConstPtr& right)
|
||||
{
|
||||
return left.mRef==right.mRef;
|
||||
}
|
||||
|
||||
inline bool operator!= (const ConstPtr& left, const ConstPtr& right)
|
||||
{
|
||||
return !(left==right);
|
||||
}
|
||||
|
||||
inline bool operator< (const ConstPtr& left, const ConstPtr& right)
|
||||
{
|
||||
return left.mRef<right.mRef;
|
||||
}
|
||||
|
||||
inline bool operator>= (const ConstPtr& left, const ConstPtr& right)
|
||||
{
|
||||
return !(left<right);
|
||||
}
|
||||
|
||||
inline bool operator> (const ConstPtr& left, const ConstPtr& right)
|
||||
{
|
||||
return right<left;
|
||||
}
|
||||
|
||||
inline bool operator<= (const ConstPtr& left, const ConstPtr& right)
|
||||
{
|
||||
return !(left>right);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue