diff --git a/apps/openmw/mwworld/ptr.cpp b/apps/openmw/mwworld/ptr.cpp index 7c0010c044..8a43dd981d 100644 --- a/apps/openmw/mwworld/ptr.cpp +++ b/apps/openmw/mwworld/ptr.cpp @@ -5,6 +5,8 @@ #include "containerstore.hpp" +const std::string MWWorld::Ptr::sEmptyString; + ESM::CellRef& MWWorld::Ptr::getCellRef() const { assert (mCellRef); diff --git a/apps/openmw/mwworld/ptr.hpp b/apps/openmw/mwworld/ptr.hpp index de1064b2b6..c028381b4b 100644 --- a/apps/openmw/mwworld/ptr.hpp +++ b/apps/openmw/mwworld/ptr.hpp @@ -11,6 +11,8 @@ namespace MWWorld class Ptr { + static const std::string sEmptyString; + public: typedef MWWorld::CellStore CellStore; @@ -20,7 +22,6 @@ namespace MWWorld ESM::CellRef *mCellRef; RefData *mRefData; CellStore *mCell; - std::string mTypeName; ContainerStore *mContainerStore; public: @@ -34,7 +35,7 @@ namespace MWWorld const std::string& getTypeName() const { - return mTypeName; + return mPtr ? mPtr->mTypeName : sEmptyString; } template @@ -45,7 +46,6 @@ namespace MWWorld mCellRef = &liveCellRef->mRef; mRefData = &liveCellRef->mData; mCell = cell; - mTypeName = typeid (T).name(); } template