aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2018-11-04 19:25:06 -0800
committerPaul Gilbert2018-12-08 19:05:59 -0800
commit75f1ac769ba8158ff73f724a91e9544b29943905 (patch)
treedcfafe991238f872a9f4d0828b0ba9ba90c0728a
parentdb61f4e0500c96503fbb69a78d7e7aafb2d71300 (diff)
downloadscummvm-rg350-75f1ac769ba8158ff73f724a91e9544b29943905.tar.gz
scummvm-rg350-75f1ac769ba8158ff73f724a91e9544b29943905.tar.bz2
scummvm-rg350-75f1ac769ba8158ff73f724a91e9544b29943905.zip
GLK: SCOTT: Fix loading and saving games
-rw-r--r--engines/gargoyle/scott/scott.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/engines/gargoyle/scott/scott.cpp b/engines/gargoyle/scott/scott.cpp
index f92754f38f..b0c3444a45 100644
--- a/engines/gargoyle/scott/scott.cpp
+++ b/engines/gargoyle/scott/scott.cpp
@@ -37,6 +37,7 @@ Scott::Scott(OSystem *syst, const GargoyleGameDescription *gameDesc) : Glk(syst,
void Scott::runGame(Common::SeekableReadStream *gameFile) {
int vb, no;
+ int saveSlot;
initialize();
Bottom = glk_window_open(0, 0, 0, wintype_TextBuffer, 1);
@@ -62,24 +63,26 @@ void Scott::runGame(Common::SeekableReadStream *gameFile) {
Top = Bottom;
}
+ // Check for savegame
+ saveSlot = ConfMan.hasKey("save_slot") ? ConfMan.getInt("save_slot") : -1;
+
output("\
Scott Free, A Scott Adams game driver in C.\n\
Release 1.14, (c) 1993,1994,1995 Swansea University Computer Society.\n\
Distributed under the GNU software license\n\n");
loadDatabase(gameFile, (Options & DEBUGGING) ? 1 : 0);
- // Check for savegame
- if (ConfMan.hasKey("save_slot")) {
- int saveSlot = ConfMan.getInt("save_slot");
- if (saveSlot >= 0)
- loadGameState(saveSlot);
- }
-
while (!shouldQuit()) {
glk_tick();
performActions(0, 0);
+ if (saveSlot >= 0) {
+ // Load any savegame during startup
+ loadGameState(saveSlot);
+ saveSlot = -1;
+ }
+
look();
if (getInput(&vb, &no) == -1)
@@ -547,9 +550,7 @@ void Scott::saveGame(void) {
Common::Error Scott::saveGameState(int slot, const Common::String &desc) {
Common::String msg;
- FileReference ref;
- ref._slotNumber = slot;
- ref._description = desc;
+ FileReference ref(slot, desc, fileusage_TextMode | fileusage_SavedGame);
strid_t file = glk_stream_open_file(&ref, filemode_Write, 0);
if (file == nullptr)
@@ -595,8 +596,7 @@ Common::Error Scott::loadGameState(int slot) {
short lo;
short darkFlag;
- FileReference ref;
- ref._slotNumber = slot;
+ FileReference ref(slot, "", fileusage_SavedGame | fileusage_TextMode);
file = glk_stream_open_file(&ref, filemode_Read, 0);
if (file == nullptr)