28 #ifndef HPL_SAVE_GAME_H 29 #define HPL_SAVE_GAME_H 31 #include "hpl1/engine/system/SerializeClass.h" 32 #include "hpl1/engine/system/SystemTypes.h" 33 #include "common/stablemap.h" 34 #include "common/multimap.h" 38 #define kSaveData_LoadFromBegin(aClass) \ 39 super::LoadFromSaveData(apSaveData); \ 40 cSaveData_##aClass *pData = static_cast<cSaveData_##aClass *>(apSaveData); \ 41 assert(pData != nullptr); 43 #define kSaveData_SaveToBegin(aClass) \ 44 super::SaveToSaveData(apSaveData); \ 45 cSaveData_##aClass *pData = static_cast<cSaveData_##aClass *>(apSaveData); \ 46 assert(pData != nullptr); 48 #define kSaveData_SetupBegin(aClass) \ 49 super::SaveDataSetup(apSaveObjectHandler, apGame); \ 50 cSaveData_##aClass *pData = static_cast<cSaveData_##aClass *>(mpSaveData); \ 51 assert(pData != nullptr); 53 #define kSaveData_BaseClass(aClass) class cSaveData_##aClass : public iSaveData 54 #define kSaveData_ChildClass(aParent, aChild) class cSaveData_##aChild : public cSaveData_##aParent 56 #define kSaveData_ClassInit(aClass) kSerializableClassInit(cSaveData_##aClass) 60 #define kSaveData_SaveTo(aVar) pData->aVar = aVar; 61 #define kSaveData_LoadFrom(aVar) aVar = pData->aVar; 63 #define kSaveData_SaveObject(aObject, aId) \ 65 pData->aId = aObject->GetSaveObjectId(); \ 70 #define kSaveData_LoadObject(aObject, aId, aClass) \ 71 if (pData->aId == -1) \ 74 aObject = static_cast<aClass>(apSaveObjectHandler->Get(pData->aId)); \ 79 #define kSaveData_SaveIdList(aSrcList, aSrcIt, aDestList) \ 80 pData->aDestList.Clear(); \ 81 for (aSrcIt it = aSrcList.begin(); it != aSrcList.end(); ++it) { \ 82 pData->aDestList.Add((*it)->GetSaveObjectId()); \ 86 #define kSaveData_LoadIdList(aSrcList, aDestList, aClass) \ 88 cContainerListIterator<int> it = pData->aDestList.GetIterator(); \ 90 while (it.HasNext()) { \ 91 int lId = it.Next(); \ 92 iSaveObject *pObject = apSaveObjectHandler->Get(lId); \ 93 if (pObject == NULL) { \ 96 aSrcList.push_back(static_cast<aClass>(pObject)); \ 104 class cSaveObjectHandler;
112 kSerializableClassInit(
iSaveData) public :
int mlSaveDataId;
122 virtual int GetSaveCreatePrio() = 0;
145 virtual void SaveToSaveData(
iSaveData *apSaveData);
149 virtual void LoadFromSaveData(
iSaveData *apSaveData);
161 void SetIsSaved(
bool abX) { mbIsSaved = abX; }
162 bool IsSaved() {
return mbIsSaved; }
170 static int _mlGlobalIdCount;
176 typedef tSaveObjectMap::iterator tSaveObjectMapIt;
193 cSaveObjectIterator GetIterator();
195 void SetUpAll(
cGame *apGame);
201 tSaveObjectMap m_mapSaveObjects;
207 typedef tSaveDataMap::iterator tSaveDataMapIt;
221 cSaveDataIterator GetIterator();
227 void AddVoidPtr(
void **apPtr);
228 void AddVoidClass(
void *apClass);
232 tSaveDataMap m_mapSaveData;
239 #endif // HPL_SAVE_GAME_H
int GetSaveObjectId()
Definition: SaveGame.h:140
Definition: Container.h:40
Definition: SystemTypes.h:467
Definition: Container.h:54
Definition: SerializeClass.h:230
Definition: SaveGame.h:130
Definition: SaveGame.h:214
Definition: SaveGame.h:111
Definition: tinyxml.h:864
Definition: SaveGame.h:183