diff options
author | Paul Gilbert | 2008-02-16 05:12:32 +0000 |
---|---|---|
committer | Paul Gilbert | 2008-02-16 05:12:32 +0000 |
commit | 9ac46607fc794a4a3514664cd587ccecfc12ad3b (patch) | |
tree | 7b0b49525ae0b13e7d755e0e91f87cd63b8c4b02 /engines/lure | |
parent | a184d81d9957d03a7700e7471aec264093da32b3 (diff) | |
download | scummvm-rg350-9ac46607fc794a4a3514664cd587ccecfc12ad3b.tar.gz scummvm-rg350-9ac46607fc794a4a3514664cd587ccecfc12ad3b.tar.bz2 scummvm-rg350-9ac46607fc794a4a3514664cd587ccecfc12ad3b.zip |
Bugfix for loading older savegame versions
svn-id: r30879
Diffstat (limited to 'engines/lure')
-rw-r--r-- | engines/lure/hotspots.cpp | 14 | ||||
-rw-r--r-- | engines/lure/res_struct.cpp | 4 |
2 files changed, 15 insertions, 3 deletions
diff --git a/engines/lure/hotspots.cpp b/engines/lure/hotspots.cpp index 60e95c3652..542432a9d5 100644 --- a/engines/lure/hotspots.cpp +++ b/engines/lure/hotspots.cpp @@ -2272,7 +2272,12 @@ void Hotspot::startTalk(HotspotData *charHotspot, uint16 id) { } void Hotspot::saveToStream(Common::WriteStream *stream) { - currentActions().saveToStream(stream); + if (_data) + _data->npcSchedule.saveToStream(stream); + else + // Hotspot doesn't have an underlying data object, so write out an empty actions list + stream->writeByte(0xff); + _pathFinder.saveToStream(stream); stream->writeUint16LE(_roomNumber); @@ -2312,7 +2317,12 @@ void Hotspot::saveToStream(Common::WriteStream *stream) { } void Hotspot::loadFromStream(Common::ReadStream *stream) { - currentActions().loadFromStream(stream); + if (_data) + _data->npcSchedule.loadFromStream(stream); + else + // Dummy read of terminator for empty actions list + assert(stream->readByte() == 0xff); + _pathFinder.loadFromStream(stream); _roomNumber = stream->readUint16LE(); diff --git a/engines/lure/res_struct.cpp b/engines/lure/res_struct.cpp index 8ce8a14f69..0903586c98 100644 --- a/engines/lure/res_struct.cpp +++ b/engines/lure/res_struct.cpp @@ -1220,9 +1220,11 @@ void BarmanLists::loadFromStream(Common::ReadStream *stream) { uint8 saveVersion = LureEngine::getReference().saveVersion(); int numEntries = (saveVersion >= 30) ? 3 : 2; + reset(); for (int index = 0; index < numEntries; ++index) { int16 value = stream->readUint16LE(); - _barList[index].currentCustomer = (value == 0) ? NULL : &_barList[index].customers[value - 1]; + _barList[index].currentCustomer = ((value < 1) || (value > NUM_SERVE_CUSTOMERS)) ? NULL : + &_barList[index].customers[value - 1]; for (int ctr = 0; ctr < NUM_SERVE_CUSTOMERS; ++ctr) { _barList[index].customers[ctr].hotspotId = stream->readUint16LE(); |