OpenMW
|
00001 #ifndef GAME_MWWORLD_LIVECELLREF_H 00002 #define GAME_MWWORLD_LIVECELLREF_H 00003 00004 #include <typeinfo> 00005 00006 #include <components/esm/cellref.hpp> 00007 00008 #include "refdata.hpp" 00009 00010 namespace MWWorld 00011 { 00012 class Ptr; 00013 class ESMStore; 00014 class Class; 00015 00017 struct LiveCellRefBase 00018 { 00019 const Class *mClass; 00020 00024 ESM::CellRef mRef; 00025 00027 RefData mData; 00028 00029 LiveCellRefBase(std::string type, const ESM::CellRef &cref=ESM::CellRef()); 00030 /* Need this for the class to be recognized as polymorphic */ 00031 virtual ~LiveCellRefBase() { } 00032 }; 00033 00040 template <typename X> 00041 struct LiveCellRef : public LiveCellRefBase 00042 { 00043 LiveCellRef(const ESM::CellRef& cref, const X* b = NULL) 00044 : LiveCellRefBase(typeid(X).name(), cref), mBase(b) 00045 {} 00046 00047 LiveCellRef(const X* b = NULL) 00048 : LiveCellRefBase(typeid(X).name()), mBase(b) 00049 {} 00050 00051 // The object that this instance is based on. 00052 const X* mBase; 00053 }; 00054 00055 // template<typename X> bool operator==(const LiveCellRef<X>& ref, int pRefnum); 00056 } 00057 00058 #endif