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 CellStore::searchInContainer (const std::string& id)
|
||||||
{
|
{
|
||||||
{
|
if (Ptr ptr = searchInContainerList (mContainers, id))
|
||||||
Ptr ptr = searchInContainerList (mContainers, id);
|
return ptr;
|
||||||
|
|
||||||
if (!ptr.isEmpty())
|
if (Ptr ptr = searchInContainerList (mCreatures, id))
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
|
||||||
|
|
||||||
{
|
if (Ptr ptr = searchInContainerList (mNpcs, id))
|
||||||
Ptr ptr = searchInContainerList (mCreatures, id);
|
return ptr;
|
||||||
|
|
||||||
if (!ptr.isEmpty())
|
|
||||||
return ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
Ptr ptr = searchInContainerList (mNpcs, id);
|
|
||||||
|
|
||||||
if (!ptr.isEmpty())
|
|
||||||
return ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Ptr();
|
return Ptr();
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,3 +55,8 @@ MWWorld::ContainerStore *MWWorld::Ptr::getContainerStore() const
|
||||||
{
|
{
|
||||||
return mContainerStore;
|
return mContainerStore;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MWWorld::Ptr::operator const void *()
|
||||||
|
{
|
||||||
|
return mRef;
|
||||||
|
}
|
|
@ -74,6 +74,9 @@ namespace MWWorld
|
||||||
|
|
||||||
ContainerStore *getContainerStore() const;
|
ContainerStore *getContainerStore() const;
|
||||||
///< May return a 0-pointer, if reference is not in a container.
|
///< 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)
|
inline bool operator== (const Ptr& left, const Ptr& right)
|
||||||
|
|
Loading…
Reference in a new issue