aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2011-08-10 20:41:39 +1000
committerPaul Gilbert2011-08-10 20:41:39 +1000
commit0c33687de29c23e7750855ca7885dfad933f869b (patch)
tree641a8624333382dee28ba30be933c92ed2d75b82
parent8cad6821bd1c045b65878e02cfd666a39d1e8ed1 (diff)
downloadscummvm-rg350-0c33687de29c23e7750855ca7885dfad933f869b.tar.gz
scummvm-rg350-0c33687de29c23e7750855ca7885dfad933f869b.tar.bz2
scummvm-rg350-0c33687de29c23e7750855ca7885dfad933f869b.zip
CGE: Further fixes to savegames.
-rw-r--r--engines/cge/cge.h1
-rw-r--r--engines/cge/cge_main.cpp11
2 files changed, 9 insertions, 3 deletions
diff --git a/engines/cge/cge.h b/engines/cge/cge.h
index d681eb43e3..55c97d0644 100644
--- a/engines/cge/cge.h
+++ b/engines/cge/cge.h
@@ -156,6 +156,7 @@ public:
void quit();
void resetQSwitch();
void optionTouch(int opt, uint16 mask);
+ void resetGame();
bool loadGame(int slotNumber, SavegameHeader *header = NULL, bool tiny = false);
void setMapBrick(int x, int z);
void switchMapping();
diff --git a/engines/cge/cge_main.cpp b/engines/cge/cge_main.cpp
index 5e7e3d9ac4..0ce514c6bb 100644
--- a/engines/cge/cge_main.cpp
+++ b/engines/cge/cge_main.cpp
@@ -192,6 +192,7 @@ bool CGEEngine::loadGame(int slotNumber, SavegameHeader *header, bool tiny) {
}
// Delete the thumbnail
+ saveHeader.thumbnail->free();
delete saveHeader.thumbnail;
// If we're loading the auto-save slot, load the name
@@ -229,15 +230,19 @@ Common::String CGEEngine::generateSaveName(int slot) {
Common::Error CGEEngine::loadGameState(int slot) {
// Clear current game activity
caveDown();
+ resetGame();
// Load the game
- loadGame(slot, NULL, true);
- caveUp();
loadGame(slot, NULL);
+ caveUp();
return Common::kNoError;
}
+void CGEEngine::resetGame() {
+ _vga->_spareQ->clear();
+}
+
Common::Error CGEEngine::saveGameState(int slot, const Common::String &desc) {
caveDown();
_oldLev = _lev;
@@ -1578,7 +1583,7 @@ void CGEEngine::runGame() {
}
// If finishing game due to closing ScummVM window, explicitly save the game
- if (!_finis)
+ if (!_finis && canSaveGameStateCurrently())
qGame();
_keyboard->setClient(NULL);