[Scummvm-cvs-logs] SF.net SVN: scummvm: [28843] scummvm/trunk/engines/agi

mthreepwood at users.sourceforge.net mthreepwood at users.sourceforge.net
Mon Sep 3 03:55:57 CEST 2007


Revision: 28843
          http://scummvm.svn.sourceforge.net/scummvm/?rev=28843&view=rev
Author:   mthreepwood
Date:     2007-09-02 18:55:56 -0700 (Sun, 02 Sep 2007)

Log Message:
-----------
make Mickey use the SaveFileManager for saving/loading

Modified Paths:
--------------
    scummvm/trunk/engines/agi/agi.h
    scummvm/trunk/engines/agi/preagi_mickey.cpp

Modified: scummvm/trunk/engines/agi/agi.h
===================================================================
--- scummvm/trunk/engines/agi/agi.h	2007-09-03 01:49:24 UTC (rev 28842)
+++ scummvm/trunk/engines/agi/agi.h	2007-09-03 01:55:56 UTC (rev 28843)
@@ -1013,6 +1013,9 @@
 	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

Modified: scummvm/trunk/engines/agi/preagi_mickey.cpp
===================================================================
--- scummvm/trunk/engines/agi/preagi_mickey.cpp	2007-09-03 01:49:24 UTC (rev 28842)
+++ scummvm/trunk/engines/agi/preagi_mickey.cpp	2007-09-03 01:55:56 UTC (rev 28843)
@@ -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 @@
 }
 
 bool Mickey::loadGame() {
-	Common::File infile;
+	Common::InSaveFile *infile;
 	char szFile[256] = {0};
 	bool diskerror = true;
 	int sel;
@@ -836,14 +837,14 @@
 
 		// 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 @@
 }
 
 void Mickey::saveGame() {
-	Common::File outfile;
+	Common::OutSaveFile* outfile;
 	char szFile[256] = {0};
 	bool diskerror = true;
 	int sel;
@@ -882,14 +883,14 @@
 
 		// 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;						
 		}
 	}
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list