aboutsummaryrefslogtreecommitdiff
path: root/engines/mads
diff options
context:
space:
mode:
authorPaul Gilbert2014-05-27 08:56:51 -0400
committerPaul Gilbert2014-05-27 08:56:51 -0400
commit46150086abded1e074d98757ea584f14641b1a36 (patch)
tree67865c1821495f894be99729db267f8f3c7829b6 /engines/mads
parent0e99e02121d10fdc8d966cab6daced74b280cef9 (diff)
downloadscummvm-rg350-46150086abded1e074d98757ea584f14641b1a36.tar.gz
scummvm-rg350-46150086abded1e074d98757ea584f14641b1a36.tar.bz2
scummvm-rg350-46150086abded1e074d98757ea584f14641b1a36.zip
MADS: Workaround for incorrect saving of dynamic hotspots in older savegames
Diffstat (limited to 'engines/mads')
-rw-r--r--engines/mads/hotspots.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/engines/mads/hotspots.cpp b/engines/mads/hotspots.cpp
index 98080f729a..497791c5a9 100644
--- a/engines/mads/hotspots.cpp
+++ b/engines/mads/hotspots.cpp
@@ -150,14 +150,10 @@ void DynamicHotspots::synchronize(Common::Serializer &s) {
int count = _entries.size();
s.syncAsSint16LE(count);
- if (s.isSaving()) {
- for (int i = 0; i < count; ++i)
- _entries[i].synchronize(s);
- } else {
- _entries.clear();
- DynamicHotspot rec;
- rec.synchronize(s);
- _entries.push_back(rec);
+ // The MIN in the below loop is a workaround to fix earlier savegame
+ // loading accidentally adding new dynamic hotspots to the fixed list
+ for (int i = 0; i < count; ++i) {
+ _entries[MIN(i, (int)_entries.size() - 1)].synchronize(s);
}
}