22 #ifndef TSAGE_SAVELOAD_H 23 #define TSAGE_SAVELOAD_H 25 #include "common/scummsys.h" 26 #include "common/list.h" 27 #include "common/memstream.h" 28 #include "common/savefile.h" 29 #include "common/serializer.h" 33 typedef void (*SaveNotifierFn)(
bool postFlag);
35 #define TSAGE_SAVEGAME_VERSION 15 43 int _saveYear, _saveMonth, _saveDay;
44 int _saveHour, _saveMinutes;
52 #define SYNC_POINTER(x) do { \ 53 SavedObject **y = (SavedObject **)((void *)&x); \ 57 #define SYNC_ENUM(FIELD, TYPE) int v_##FIELD = (int)FIELD; s.syncAsUint16LE(v_##FIELD); \ 58 if (s.isLoading()) FIELD = (TYPE)v_##FIELD; 71 void setSaveVersion(byte version) { _version = version; }
73 void syncPointer(
SavedObject **ptr, Common::Serializer::Version minVersion = 0,
74 Common::Serializer::Version maxVersion = kLastVersion);
75 void validate(
const Common::String &s, Common::Serializer::Version minVersion = 0,
76 Common::Serializer::Version maxVersion = kLastVersion);
77 void validate(
int v, Common::Serializer::Version minVersion = 0,
78 Common::Serializer::Version maxVersion = kLastVersion);
79 void syncAsDouble(
double &v);
93 virtual void listenerSynchronize(
Serializer &s) = 0;
122 s.syncAsUint32LE(entryCount);
124 for (
int idx = 0; idx < entryCount; ++idx) {
125 this->push_back(static_cast<T>((T)NULL));
131 entryCount = this->size();
134 s.syncAsUint32LE(entryCount);
141 void addBefore(T existingItem, T newItem) {
143 while ((i != this->end()) && (*i != existingItem)) ++i;
144 this->insert(i, newItem);
146 void addAfter(T existingItem, T newItem) {
148 while ((i != this->end()) && (*i != existingItem)) ++i;
149 if (i != this->end()) ++i;
150 this->insert(i, newItem);
153 bool contains(T item) {
155 for (; i != this->end(); ++i) {
211 SavedObjectFactory _factoryPtr;
214 bool _macroRestoreFlag;
216 void resolveLoadPointers(DynObjects &dynObjects);
227 void addSaveNotifier(SaveNotifierFn fn);
228 void addLoadNotifier(SaveNotifierFn fn);
231 void addFactory(SavedObjectFactory fn) { _factoryPtr = fn; }
232 void addSavedObjectPtr(
SavedObject **ptr,
int objIndex) {
236 bool savegamesExist()
const;
237 bool getMacroSaveFlag()
const {
return _macroSaveFlag; }
238 bool getMacroRestoreFlag()
const {
return _macroRestoreFlag; }
240 int getObjectCount()
const;
244 extern Saver *g_saver;
Definition: saveload.h:98
Definition: saveload.h:84
Definition: saveload.h:191
Definition: savefile.h:54
In find(In first, In last, const T &v)
Definition: algorithm.h:225
Definition: saveload.h:202
Definition: serializer.h:79
t_T & back()
Definition: list.h:167
iterator end()
Definition: list.h:240
iterator begin()
Definition: list.h:227
bool skipThumbnail(Common::SeekableReadStream &in)
Definition: saveload.h:115
Definition: blueforce_dialogs.h:30
Definition: saveload.h:63
Definition: list_intern.h:51
void push_back(const t_T &element)
Definition: list.h:140
Definition: saveload.h:90
Definition: saveload.h:180