[Scummvm-cvs-logs] CVS: scummvm/sword1 control.cpp,1.34,1.35 control.h,1.14,1.15 sword1.cpp,1.43,1.44

Max Horn fingolfin at users.sourceforge.net
Fri Jun 25 15:40:05 CEST 2004


Update of /cvsroot/scummvm/scummvm/sword1
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14375/sword1

Modified Files:
	control.cpp control.h sword1.cpp 
Log Message:
Added Engine::_saveFileMan; thus was able to get rid of auto_ptr usage again

Index: control.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/control.cpp,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -d -r1.34 -r1.35
--- control.cpp	25 Jun 2004 22:12:56 -0000	1.34
+++ control.cpp	25 Jun 2004 22:39:21 -0000	1.35
@@ -37,8 +37,6 @@
 #include "sword1/sworddefs.h"
 #include "sword1/swordres.h"
 
-#include <memory>
-
 namespace Sword1 {
 
 #define SAVEFILE_WRITE true
@@ -158,7 +156,8 @@
 	draw();
 }
 
-Control::Control(ResMan *pResMan, ObjectMan *pObjMan, OSystem *system, Mouse *pMouse, Sound *pSound, Music *pMusic, const char *savePath) {
+Control::Control(SaveFileManager *saveFileMan, ResMan *pResMan, ObjectMan *pObjMan, OSystem *system, Mouse *pMouse, Sound *pSound, Music *pMusic, const char *savePath) {
+	_saveFileMan = saveFileMan;
 	_resMan = pResMan;
 	_objMan = pObjMan;
 	_system = system;
@@ -667,10 +666,8 @@
 }
 
 void Control::readSavegameDescriptions(void) {
-	const std::auto_ptr<SaveFileManager> mgr(_system->get_savefile_manager());
-
 	SaveFile *inf;
-	inf = mgr->open_savefile("SAVEGAME.INF", _savePath, SAVEFILE_READ);
+	inf = _saveFileMan->open_savefile("SAVEGAME.INF", _savePath, SAVEFILE_READ);
 	_saveScrollPos = _saveFiles = 0;
 	_selectedSavegame = 255;
 	if (inf && inf->isOpen()) {
@@ -714,10 +711,8 @@
 }
 
 void Control::writeSavegameDescriptions(void) {
-	const std::auto_ptr<SaveFileManager> mgr(_system->get_savefile_manager());
-
 	SaveFile *outf;
-	outf = mgr->open_savefile("SAVEGAME.INF", _savePath, SAVEFILE_WRITE);
+	outf = _saveFileMan->open_savefile("SAVEGAME.INF", _savePath, SAVEFILE_WRITE);
 	
 	if (!outf) {
 		// Display an error message, and do nothing
@@ -741,10 +736,8 @@
 
 bool Control::savegamesExist(void) {
 	bool retVal = false;
-	const std::auto_ptr<SaveFileManager> mgr(_system->get_savefile_manager());
-
 	SaveFile *inf;
-	inf = mgr->open_savefile("SAVEGAME.INF", _savePath, SAVEFILE_READ);
+	inf = _saveFileMan->open_savefile("SAVEGAME.INF", _savePath, SAVEFILE_READ);
 	if (inf && inf->isOpen())
 		retVal = true;
 	delete inf;
@@ -900,10 +893,8 @@
 	uint16 cnt;
 	sprintf(fName, "SAVEGAME.%03d", slot);
 	uint16 liveBuf[TOTAL_SECTIONS];
-	const std::auto_ptr<SaveFileManager> mgr(_system->get_savefile_manager());
-
 	SaveFile *outf;
-	outf = mgr->open_savefile(fName, _savePath, SAVEFILE_WRITE);
+	outf = _saveFileMan->open_savefile(fName, _savePath, SAVEFILE_WRITE);
 	if (!outf || !outf->isOpen()) {
 		// Display an error message, and do nothing
 		displayMessage(0, "Unable to create file '%s' in directory '%s'", fName, _savePath);
@@ -935,10 +926,8 @@
 	char fName[15];
 	uint16 cnt;
 	sprintf(fName, "SAVEGAME.%03d", slot);
-	const std::auto_ptr<SaveFileManager> mgr(_system->get_savefile_manager());
-
 	SaveFile *inf;
-	inf = mgr->open_savefile(fName, _savePath, SAVEFILE_READ);
+	inf = _saveFileMan->open_savefile(fName, _savePath, SAVEFILE_READ);
 	if (!inf || !inf->isOpen()) {
 		// Display an error message, and do nothing
 		displayMessage(0, "Can't open file '%s' in directory '%s'", fName, _savePath);

Index: control.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/control.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- control.h	12 May 2004 06:21:44 -0000	1.14
+++ control.h	25 Jun 2004 22:39:21 -0000	1.15
@@ -26,6 +26,7 @@
 #include "sworddefs.h"
 
 class OSystem;
+class SaveFileManager;
 
 namespace Sword1 {
 
@@ -67,7 +68,7 @@
 
 class Control {
 public:
-	Control(ResMan *pResMan, ObjectMan *pObjMan, OSystem *system, Mouse *pMouse, Sound *pSound, Music *pMusic, const char *savePath);
+	Control(SaveFileManager *saveFileMan, ResMan *pResMan, ObjectMan *pObjMan, OSystem *system, Mouse *pMouse, Sound *pSound, Music *pMusic, const char *savePath);
 	~Control(void);
 	uint8 runPanel(void);
 	void doRestore(void);
@@ -119,6 +120,7 @@
 	static const ButtonInfo _deathButtons[3], _panelButtons[7], _saveButtons[16], _volumeButtons[4];
 	static const uint8 _languageStrings[8 * 20][43];
 	const uint8 (*_lStrings)[43];
+	SaveFileManager *_saveFileMan;
 	ObjectMan *_objMan;
 	ResMan *_resMan;
 	OSystem *_system;

Index: sword1.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword1/sword1.cpp,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- sword1.cpp	31 Mar 2004 18:00:46 -0000	1.43
+++ sword1.cpp	25 Jun 2004 22:39:21 -0000	1.44
@@ -161,7 +161,7 @@
 	_logic->initialize();
 	_objectMan->initialize();
 	_mouse->initialize();
-	_control = new Control(_resMan, _objectMan, _system, _mouse, _sound, _music, getSavePath());
+	_control = new Control(_saveFileMan, _resMan, _objectMan, _system, _mouse, _sound, _music, getSavePath());
 }
 
 void SwordEngine::reinitialize(void) {





More information about the Scummvm-git-logs mailing list