From 46150086abded1e074d98757ea584f14641b1a36 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Tue, 27 May 2014 08:56:51 -0400 Subject: MADS: Workaround for incorrect saving of dynamic hotspots in older savegames --- engines/mads/hotspots.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'engines/mads') 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); } } -- cgit v1.2.3