22 #ifndef STARK_SERVICES_STATE_PROVIDER_H 23 #define STARK_SERVICES_STATE_PROVIDER_H 25 #include "common/hashmap.h" 26 #include "common/serializer.h" 27 #include "common/hash-str.h" 28 #include "common/stream.h" 29 #include "common/substream.h" 31 #include "math/mathfwd.h" 33 #include "engines/stark/resourcereference.h" 55 void syncAsFloat(
float &value);
56 void syncAsVector3d(Math::Vector3d &value);
61 void syncAsResourceReference(T **
object, Version minVersion = 0, Version maxVersion = kLastVersion);
64 void syncArraySize(
Common::Array<T> &array, Version minVersion = 0, Version maxVersion = kLastVersion);
68 void ResourceSerializer::syncAsResourceReference(T **
object, Version minVersion, Version maxVersion) {
71 if (_version < minVersion || _version > maxVersion)
77 *
object = reference.
resolve<T>();
86 void ResourceSerializer::syncArraySize(
Common::Array<T> &array, Version minVersion, Version maxVersion) {
87 if (_version < minVersion || _version > maxVersion)
90 uint32 size = array.
size();
128 static const uint kMinSaveVersion = 6;
129 static const uint kSaveVersion = 13;
132 class ResourceTreeState {
134 ResourceTreeState(uint32 size, byte *data, uint32 version);
135 ~ResourceTreeState();
137 uint32 getVersion()
const {
return _version; }
138 uint32 getSize()
const {
return _size; }
139 byte *getData()
const {
return _data; }
155 ResourceTreeStateMap _stateStore;
160 #endif // STARK_SERVICES_STATE_PROVIDER_H Definition: location.h:51
T * resolve() const
Definition: resourcereference.h:84
Definition: serializer.h:79
void loadFromStream(Common::ReadStream *stream)
Definition: resourcereference.h:39
Definition: substream.h:78
Definition: stateprovider.h:103
size_type size() const
Definition: array.h:315
void buildFromResource(Resources::Object *resource)
void saveToStream(Common::WriteStream *stream)
void resize(size_type newSize)
Definition: array.h:411
Definition: stateprovider.h:43
Definition: stateprovider.h:51