aboutsummaryrefslogtreecommitdiff
path: root/engines/mads/resources.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/mads/resources.cpp')
-rw-r--r--engines/mads/resources.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/engines/mads/resources.cpp b/engines/mads/resources.cpp
index b6caed7b0c..f0609448bb 100644
--- a/engines/mads/resources.cpp
+++ b/engines/mads/resources.cpp
@@ -384,4 +384,45 @@ void File::openFile(const Common::String &filename) {
error("Could not open file - %s", filename.c_str());
}
+/*------------------------------------------------------------------------*/
+
+void SynchronizedList::synchronize(Common::Serializer &s) {
+ int v;
+ int count = size();
+ s.syncAsUint16LE(count);
+
+ if (s.isSaving()) {
+ for (int idx = 0; idx < count; ++idx) {
+ v = (*this)[idx];
+ s.syncAsSint32LE(v);
+ }
+ } else {
+ clear();
+ reserve(count);
+ for (int idx = 0; idx < count; ++idx) {
+ s.syncAsSint32LE(v);
+ push_back(v);
+ }
+ }
+}
+
+/*------------------------------------------------------------------------*/
+
+void synchronizeString(Common::Serializer &s, Common::String &str) {
+ int len = str.size();
+ char c;
+ s.syncAsUint16LE(len);
+
+ if (s.isSaving()) {
+ s.syncBytes((byte *)str.c_str(), len);
+ } else {
+ str.clear();
+ for (int i = 0; i < len; ++i) {
+ s.syncAsByte(c);
+ str += c;
+ }
+ }
+}
+
+
} // End of namespace MADS