From 31b01f0d11307b82d3eeedbda9d70fe651313058 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Mon, 7 Oct 2013 07:15:54 +0200 Subject: AVALANCHE: Add save/load code --- engines/avalanche/parser.cpp | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index e3383c7785..6bca4765ec 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -28,6 +28,8 @@ #include "avalanche/avalanche.h" #include "avalanche/parser.h" +#include "gui/saveload.h" + namespace Avalanche { const char *Parser::kCopyright = "1995"; @@ -1789,9 +1791,28 @@ void Parser::doThat() { swallow(); break; - case kVerbCodeLoad: + case kVerbCodeLoad: { + GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Restore game:", "Restore", false); + int16 savegameId = dialog->runModalWithCurrentTarget(); + delete dialog; + + if (savegameId < 0) // dialog aborted + return; + + _vm->loadGame(savegameId); + } break; - case kVerbCodeSave: + case kVerbCodeSave: { + GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser("Save game:", "Save", true); + int16 savegameId = dialog->runModalWithCurrentTarget(); + Common::String savegameDescription = dialog->getResultString(); + delete dialog; + + if (savegameId < 0) // dialog aborted + return; + + _vm->saveGame(savegameId, savegameDescription); + } break; // We don't handle these two because we use ScummVM's save/load system. -- cgit v1.2.3