make Ptr a bit more pointer-like

actorid
Marc Zinnschlag 11 years ago
parent b72c1c2c58
commit f220867144

@ -342,26 +342,14 @@ namespace MWWorld
Ptr CellStore::searchInContainer (const std::string& id)
{
{
Ptr ptr = searchInContainerList (mContainers, id);
if (!ptr.isEmpty())
return ptr;
}
if (Ptr ptr = searchInContainerList (mContainers, id))
return ptr;
{
Ptr ptr = searchInContainerList (mCreatures, id);
if (Ptr ptr = searchInContainerList (mCreatures, id))
return ptr;
if (!ptr.isEmpty())
return ptr;
}
{
Ptr ptr = searchInContainerList (mNpcs, id);
if (!ptr.isEmpty())
return ptr;
}
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…
Cancel
Save