make Mickey use the SaveFileManager for saving/loading

svn-id: r28843
This commit is contained in:
Matthew Hoops 2007-09-03 01:55:56 +00:00
parent 30c479a7e4
commit 5a5e994e4f
2 changed files with 12 additions and 8 deletions

View File

@ -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

View File

@ -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;
}
}