aboutsummaryrefslogtreecommitdiff
path: root/sky
diff options
context:
space:
mode:
authorMax Horn2004-06-25 22:39:21 +0000
committerMax Horn2004-06-25 22:39:21 +0000
commit6b722ff11bcaa4622cf662245819993316eb8c5d (patch)
tree32c18fbb30a80698904e50377b5ce2b83739246d /sky
parent7a8d469c666f162570f633ec465798e1e5720eef (diff)
downloadscummvm-rg350-6b722ff11bcaa4622cf662245819993316eb8c5d.tar.gz
scummvm-rg350-6b722ff11bcaa4622cf662245819993316eb8c5d.tar.bz2
scummvm-rg350-6b722ff11bcaa4622cf662245819993316eb8c5d.zip
Added Engine::_saveFileMan; thus was able to get rid of auto_ptr usage again
svn-id: r14058
Diffstat (limited to 'sky')
-rw-r--r--sky/control.cpp25
-rw-r--r--sky/control.h4
-rw-r--r--sky/sky.cpp2
3 files changed, 12 insertions, 19 deletions
diff --git a/sky/control.cpp b/sky/control.cpp
index 6f43b3f0ea..5e30a68b3c 100644
--- a/sky/control.cpp
+++ b/sky/control.cpp
@@ -35,8 +35,6 @@
#include "sky/struc.h"
#include "sky/text.h"
-#include <memory>
-
namespace Sky {
ConResource::ConResource(void *pSpData, uint32 pNSprites, uint32 pCurSprite, uint16 pX, uint16 pY, uint32 pText, uint8 pOnClick, OSystem *system, uint8 *screen) {
@@ -191,7 +189,8 @@ void ControlStatus::drawToScreen(void) {
_statusText->drawToScreen(WITH_MASK);
}
-Control::Control(Screen *screen, Disk *disk, Mouse *mouse, Text *text, MusicBase *music, Logic *logic, Sound *sound, OSystem *system, const char *savePath) {
+Control::Control(SaveFileManager *saveFileMan, Screen *screen, Disk *disk, Mouse *mouse, Text *text, MusicBase *music, Logic *logic, Sound *sound, OSystem *system, const char *savePath) {
+ _saveFileMan = saveFileMan;
_skyScreen = screen;
_skyDisk = disk;
@@ -784,9 +783,8 @@ bool Control::autoSaveExists(void) {
strcpy(fName, "SKY-VM-CD.ASD");
else
sprintf(fName, "SKY-VM%03d.ASD", SkyEngine::_systemVars.gameVersion);
- const std::auto_ptr<SaveFileManager> mgr(_system->get_savefile_manager());
- f = mgr->open_savefile(fName, _savePath, false);
+ f = _saveFileMan->open_savefile(fName, _savePath, false);
if (f != NULL) {
test = true;
delete f;
@@ -1004,10 +1002,8 @@ void Control::loadDescriptions(uint8 *destBuf) {
memset(destBuf, 0, MAX_SAVE_GAMES * MAX_TEXT_LEN);
- const std::auto_ptr<SaveFileManager> mgr(_system->get_savefile_manager());
-
SaveFile *inf;
- inf = mgr->open_savefile("SKY-VM.SAV",_savePath,false);
+ inf = _saveFileMan->open_savefile("SKY-VM.SAV",_savePath,false);
if (inf != NULL) {
uint8 *tmpBuf = (uint8 *)malloc(MAX_SAVE_GAMES * MAX_TEXT_LEN);
inf->read(tmpBuf, MAX_SAVE_GAMES * MAX_TEXT_LEN);
@@ -1065,9 +1061,8 @@ void Control::saveDescriptions(uint8 *srcBuf) {
srcPos += MAX_TEXT_LEN;
}
SaveFile *outf;
- const std::auto_ptr<SaveFileManager> mgr(_system->get_savefile_manager());
- outf = mgr->open_savefile("SKY-VM.SAV", _savePath, true);
+ outf = _saveFileMan->open_savefile("SKY-VM.SAV", _savePath, true);
if (outf != NULL) {
outf->write(tmpBuf, tmpPos - tmpBuf);
delete outf;
@@ -1082,9 +1077,8 @@ void Control::doAutoSave(void) {
else
sprintf(fName, "SKY-VM%03d.ASD", SkyEngine::_systemVars.gameVersion);
SaveFile *outf;
- const std::auto_ptr<SaveFileManager> mgr(_system->get_savefile_manager());
- outf = mgr->open_savefile(fName, _savePath, true);
+ outf = _saveFileMan->open_savefile(fName, _savePath, true);
if (outf == NULL) {
warning("Can't create file %s for autosaving", fName);
return;
@@ -1102,10 +1096,9 @@ uint16 Control::saveGameToFile(void) {
char fName[20];
sprintf(fName,"SKY-VM.%03d", _selectedGame);
- const std::auto_ptr<SaveFileManager> mgr(_system->get_savefile_manager());
SaveFile *outf;
- outf = mgr->open_savefile(fName, _savePath, true);
+ outf = _saveFileMan->open_savefile(fName, _savePath, true);
if (outf == NULL) {
return NO_DISK_SPACE;
}
@@ -1507,10 +1500,8 @@ uint16 Control::restoreGameFromFile(bool autoSave) {
} else
sprintf(fName,"SKY-VM.%03d", _selectedGame);
- const std::auto_ptr<SaveFileManager> mgr(_system->get_savefile_manager());
-
SaveFile *inf;
- inf = mgr->open_savefile(fName, _savePath, false);
+ inf = _saveFileMan->open_savefile(fName, _savePath, false);
if (inf == NULL) {
return RESTORE_FAILED;
}
diff --git a/sky/control.h b/sky/control.h
index c670c4f5cf..8a29df20e7 100644
--- a/sky/control.h
+++ b/sky/control.h
@@ -26,6 +26,7 @@
#include "common/scummsys.h"
class OSystem;
+class SaveFileManager;
namespace Sky {
@@ -174,7 +175,7 @@ private:
class Control {
public:
- Control(Screen *screen, Disk *disk, Mouse *mouse, Text *text, MusicBase *music, Logic *logic, Sound *sound, OSystem *system, const char *savePath);
+ Control(SaveFileManager *saveFileMan, Screen *screen, Disk *disk, Mouse *mouse, Text *text, MusicBase *music, Logic *logic, Sound *sound, OSystem *system, const char *savePath);
void doControlPanel(void);
void doLoadSavePanel(void);
void restartGame(void);
@@ -242,6 +243,7 @@ private:
void appendMemList(uint16 *pMem);
void freeMemList(void);
+ SaveFileManager *_saveFileMan;
Screen *_skyScreen;
Disk *_skyDisk;
Mouse *_skyMouse;
diff --git a/sky/sky.cpp b/sky/sky.cpp
index f149e4988c..2bd538d79f 100644
--- a/sky/sky.cpp
+++ b/sky/sky.cpp
@@ -296,7 +296,7 @@ void SkyEngine::initialise(void) {
// initialize timer *after* _skyScreen has been initialized.
_timer->installTimerProc(&timerHandler, 1000000 / 50, this); //call 50 times per second
- _skyControl = new Control(_skyScreen, _skyDisk, _skyMouse, _skyText, _skyMusic, _skyLogic, _skySound, _system, getSavePath());
+ _skyControl = new Control(_saveFileMan, _skyScreen, _skyDisk, _skyMouse, _skyText, _skyMusic, _skyLogic, _skySound, _system, getSavePath());
_skyLogic->useControlInstance(_skyControl);
if (_systemVars.gameVersion == 288)