#ifndef GAME_MWWORLD_PTR_H #define GAME_MWWORLD_PTR_H #include #include #include #include "refdata.hpp" namespace MWWorld { /// \brief Pointer to a LiveCellRef class Ptr { boost::any mPtr; ESM::CellRef *mCellRef; RefData *mRefData; public: Ptr() : mCellRef (0), mRefData (0) {} template Ptr (ESMS::LiveCellRef *liveCellRef) { mPtr = liveCellRef; mCellRef = &liveCellRef->ref; mRefData = &liveCellRef->mData; } template ESMS::LiveCellRef *get() const { return boost::any_cast*> (mPtr); } ESM::CellRef& getCellRef() const { assert (mCellRef); return *mCellRef; } RefData& getRefData() const { assert (mRefData); return *mRefData; } }; } #endif