diff options
Diffstat (limited to 'engines/mads/globals.cpp')
-rw-r--r-- | engines/mads/globals.cpp | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/engines/mads/globals.cpp b/engines/mads/globals.cpp index 68a2cf1970..de15ba9595 100644 --- a/engines/mads/globals.cpp +++ b/engines/mads/globals.cpp @@ -26,8 +26,27 @@ namespace MADS { void Globals::reset() { - for (uint i = 0; i < _flags.size(); ++i) - _flags[i] = 0; + for (uint i = 0; i < _data.size(); ++i) + _data[i] = 0; +} + +void Globals::synchronize(Common::Serializer &s) { + int count = 0; + int16 v; + s.syncAsUint16LE(count); + + if (s.isSaving()) { + for (int idx = 0; idx < count; ++idx) { + v = _data[idx]; + s.syncAsSint16LE(v); + } + } else { + _data.clear(); + for (int idx = 0; idx < count; ++idx) { + s.syncAsSint16LE(v); + _data.push_back(v); + } + } } |