aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorSven Hesse2009-07-23 19:50:13 +0000
committerSven Hesse2009-07-23 19:50:13 +0000
commit01b8320367f48456471a6f91a47b2dacdd871b57 (patch)
tree2462ac37587792f22bcf8e5c19c9ddcd192af48b /engines
parent33929b5248c754d10b018e6f87b9ebe99c968c02 (diff)
downloadscummvm-rg350-01b8320367f48456471a6f91a47b2dacdd871b57.tar.gz
scummvm-rg350-01b8320367f48456471a6f91a47b2dacdd871b57.tar.bz2
scummvm-rg350-01b8320367f48456471a6f91a47b2dacdd871b57.zip
Fixing a bug in the V4 save file handler, produced by a "neat" feature in Woodruff: The saves remember their position within the list and use that information to load the "correct" screen properties, making it impossible to load reordered saves correctly -.-
svn-id: r42679
Diffstat (limited to 'engines')
-rw-r--r--engines/gob/save/saveload.h4
-rw-r--r--engines/gob/save/saveload_v4.cpp20
2 files changed, 22 insertions, 2 deletions
diff --git a/engines/gob/save/saveload.h b/engines/gob/save/saveload.h
index 700462f315..1a1a47178b 100644
--- a/engines/gob/save/saveload.h
+++ b/engines/gob/save/saveload.h
@@ -289,6 +289,8 @@ protected:
GameHandler(GobEngine *vm, const char *target);
~GameHandler();
+ int getLastSlot() const;
+
int32 getSize();
bool load(int16 dataVar, int32 size, int32 offset);
bool save(int16 dataVar, int32 size, int32 offset);
@@ -317,6 +319,8 @@ protected:
File *_slotFile;
+ int _lastSlot;
+
SaveReader *_reader;
SaveWriter *_writer;
diff --git a/engines/gob/save/saveload_v4.cpp b/engines/gob/save/saveload_v4.cpp
index 06280af2a6..16c87b9a64 100644
--- a/engines/gob/save/saveload_v4.cpp
+++ b/engines/gob/save/saveload_v4.cpp
@@ -84,6 +84,8 @@ SaveLoad_v4::GameHandler::GameHandler(GobEngine *vm, const char *target) : SaveH
_slotFile = new File(vm, target);
+ _lastSlot = -1;
+
_writer = 0;
_reader = 0;
}
@@ -94,6 +96,10 @@ SaveLoad_v4::GameHandler::~GameHandler() {
delete _writer;
}
+int SaveLoad_v4::GameHandler::getLastSlot() const {
+ return _lastSlot;
+}
+
int32 SaveLoad_v4::GameHandler::getSize() {
// Fake an empty save file for the very first query, to get clear properties
if (_firstSize) {
@@ -178,6 +184,7 @@ bool SaveLoad_v4::GameHandler::load(int16 dataVar, int32 size, int32 offset) {
if (!vars.writeInto(0, 0, varSize))
return false;
+ _lastSlot = slot;
}
return true;
@@ -261,6 +268,7 @@ bool SaveLoad_v4::GameHandler::save(int16 dataVar, int32 size, int32 offset) {
if (!_writer->writePart(1, &vars))
return false;
+ _lastSlot = slot;
}
return true;
@@ -465,7 +473,11 @@ bool SaveLoad_v4::ScreenPropsHandler::load(int16 dataVar, int32 size, int32 offs
return false;
}
- return _gameHandler->loadScreenProps(_file->getSlot(offset), _curProps->_props);
+ int slot = _gameHandler->getLastSlot();
+ if (slot == -1)
+ slot = _file->getSlot(offset);
+
+ return _gameHandler->loadScreenProps(slot, _curProps->_props);
}
bool SaveLoad_v4::ScreenPropsHandler::save(int16 dataVar, int32 size, int32 offset) {
@@ -474,7 +486,11 @@ bool SaveLoad_v4::ScreenPropsHandler::save(int16 dataVar, int32 size, int32 offs
return false;
}
- return _gameHandler->saveScreenProps(_file->getSlot(offset), _curProps->_props);
+ int slot = _gameHandler->getLastSlot();
+ if (slot == -1)
+ slot = _file->getSlot(offset);
+
+ return _gameHandler->saveScreenProps(slot, _curProps->_props);
}