From 5a5e994e4fdcfd1c509fdedeae5c4d8157996627 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Mon, 3 Sep 2007 01:55:56 +0000 Subject: make Mickey use the SaveFileManager for saving/loading svn-id: r28843 --- engines/agi/agi.h | 3 +++ engines/agi/preagi_mickey.cpp | 17 +++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/engines/agi/agi.h b/engines/agi/agi.h index 1dce3f46a9..25516229e9 100644 --- a/engines/agi/agi.h +++ b/engines/agi/agi.h @@ -1013,6 +1013,9 @@ public: void drawStrMiddle(int row, int attr, const char *buffer); void clearTextArea(); void clearRow(int row); + + // Saved Games + Common::SaveFileManager* getSaveFileMan() { return _saveFileMan; } }; } // End of namespace Agi diff --git a/engines/agi/preagi_mickey.cpp b/engines/agi/preagi_mickey.cpp index 275ee06e25..b5d0471c7f 100644 --- a/engines/agi/preagi_mickey.cpp +++ b/engines/agi/preagi_mickey.cpp @@ -25,6 +25,7 @@ #include "common/stdafx.h" #include "common/events.h" +#include "common/savefile.h" #include "agi/preagi_mickey.h" #include "agi/graphics.h" @@ -824,7 +825,7 @@ void Mickey::printRoomDesc() { } bool Mickey::loadGame() { - Common::File infile; + Common::InSaveFile *infile; char szFile[256] = {0}; bool diskerror = true; int sel; @@ -836,14 +837,14 @@ bool Mickey::loadGame() { // load game sprintf(szFile, "%s.s%2d", _vm->getTargetName().c_str(), sel); - if (!infile.open(szFile)) { + if (!(infile = _vm->getSaveFileMan()->openForLoading(szFile))) { printExeStr(IDO_MSA_CHECK_DISK_DRIVE); if (!_vm->waitAnyKeyChoice()) return false; } else { - infile.read(&game, sizeof(MSA_GAME)); + infile->read(&game, sizeof(MSA_GAME)); diskerror = false; - infile.close(); + delete infile; } } @@ -852,7 +853,7 @@ bool Mickey::loadGame() { } void Mickey::saveGame() { - Common::File outfile; + Common::OutSaveFile* outfile; char szFile[256] = {0}; bool diskerror = true; int sel; @@ -882,14 +883,14 @@ void Mickey::saveGame() { // save game sprintf(szFile, "%s.s%2d", _vm->getTargetName().c_str(), sel); - if (!outfile.open(szFile)) { + if (!(outfile = _vm->getSaveFileMan()->openForSaving(szFile))) { printExeStr(IDO_MSA_CHECK_DISK_DRIVE); if (!_vm->waitAnyKeyChoice()) return; } else { - outfile.write(&game, sizeof(MSA_GAME)); + outfile->write(&game, sizeof(MSA_GAME)); diskerror = false; - outfile.close(); + delete outfile; } } -- cgit v1.2.3