forked from teamnwah/openmw-tes3coop
make Ptr a bit more pointer-like
This commit is contained in:
parent
b72c1c2c58
commit
f220867144
3 changed files with 14 additions and 18 deletions
|
@ -342,26 +342,14 @@ namespace MWWorld
|
|||
|
||||
Ptr CellStore::searchInContainer (const std::string& id)
|
||||
{
|
||||
{
|
||||
Ptr ptr = searchInContainerList (mContainers, id);
|
||||
|
||||
if (!ptr.isEmpty())
|
||||
if (Ptr ptr = searchInContainerList (mContainers, id))
|
||||
return ptr;
|
||||
}
|
||||
|
||||
{
|
||||
Ptr ptr = searchInContainerList (mCreatures, id);
|
||||
|
||||
if (!ptr.isEmpty())
|
||||
if (Ptr ptr = searchInContainerList (mCreatures, id))
|
||||
return ptr;
|
||||
}
|
||||
|
||||
{
|
||||
Ptr ptr = searchInContainerList (mNpcs, id);
|
||||
|
||||
if (!ptr.isEmpty())
|
||||
if (Ptr ptr = searchInContainerList (mNpcs, id))
|
||||
return ptr;
|
||||
}
|
||||
|
||||
return Ptr();
|
||||
}
|
||||
|
|
|
@ -55,3 +55,8 @@ MWWorld::ContainerStore *MWWorld::Ptr::getContainerStore() const
|
|||
{
|
||||
return mContainerStore;
|
||||
}
|
||||
|
||||
MWWorld::Ptr::operator const void *()
|
||||
{
|
||||
return mRef;
|
||||
}
|
|
@ -74,6 +74,9 @@ namespace MWWorld
|
|||
|
||||
ContainerStore *getContainerStore() const;
|
||||
///< May return a 0-pointer, if reference is not in a container.
|
||||
|
||||
operator const void *();
|
||||
///< Return a 0-pointer, if Ptr is empty; return a non-0-pointer, if Ptr is not empty
|
||||
};
|
||||
|
||||
inline bool operator== (const Ptr& left, const Ptr& right)
|
||||
|
|
Loading…
Reference in a new issue