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"
33typedef 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;
146 void addAfter(T existingItem, T newItem) {
148 while ((i != this->
end()) && (*i != existingItem)) ++i;
149 if (i != this->
end()) ++i;
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;
244extern Saver *g_saver;
iterator begin()
Definition: list.h:266
size_type size() const
Definition: list.h:237
ListInternal::Iterator< void(*)(T) > iterator
Definition: list.h:52
void clear()
Definition: list.h:245
iterator insert(iterator pos, const T &element)
Definition: list.h:86
t_T & back()
Definition: list.h:206
void push_back(const T &element)
Definition: list.h:174
iterator end()
Definition: list.h:279
Definition: savefile.h:54
Definition: serializer.h:80
Definition: saveload.h:180
Definition: saveload.h:90
Definition: saveload.h:98
Definition: saveload.h:191
Definition: saveload.h:202
Definition: saveload.h:84
Definition: saveload.h:63
Definition: saveload.h:115
In find(In first, In last, const T &v)
Definition: algorithm.h:225
bool skipThumbnail(Common::SeekableReadStream &in)
Definition: list_intern.h:54