[Scummvm-cvs-logs] SF.net SVN: scummvm: [30879] scummvm/trunk/engines/lure

dreammaster at users.sourceforge.net dreammaster at users.sourceforge.net
Sat Feb 16 06:12:32 CET 2008


Revision: 30879
          http://scummvm.svn.sourceforge.net/scummvm/?rev=30879&view=rev
Author:   dreammaster
Date:     2008-02-15 21:12:32 -0800 (Fri, 15 Feb 2008)

Log Message:
-----------
Bugfix for loading older savegame versions

Modified Paths:
--------------
    scummvm/trunk/engines/lure/hotspots.cpp
    scummvm/trunk/engines/lure/res_struct.cpp

Modified: scummvm/trunk/engines/lure/hotspots.cpp
===================================================================
--- scummvm/trunk/engines/lure/hotspots.cpp	2008-02-16 03:22:53 UTC (rev 30878)
+++ scummvm/trunk/engines/lure/hotspots.cpp	2008-02-16 05:12:32 UTC (rev 30879)
@@ -2272,7 +2272,12 @@
 }
 
 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::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();

Modified: scummvm/trunk/engines/lure/res_struct.cpp
===================================================================
--- scummvm/trunk/engines/lure/res_struct.cpp	2008-02-16 03:22:53 UTC (rev 30878)
+++ scummvm/trunk/engines/lure/res_struct.cpp	2008-02-16 05:12:32 UTC (rev 30879)
@@ -1220,9 +1220,11 @@
 	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();


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list