aboutsummaryrefslogtreecommitdiff
path: root/sword1
diff options
context:
space:
mode:
Diffstat (limited to 'sword1')
-rw-r--r--sword1/control.cpp19
-rw-r--r--sword1/control.h3
-rw-r--r--sword1/sword1.cpp2
3 files changed, 11 insertions, 13 deletions
diff --git a/sword1/control.cpp b/sword1/control.cpp
index 5d71435f1b..989a14b6de 100644
--- a/sword1/control.cpp
+++ b/sword1/control.cpp
@@ -156,7 +156,7 @@ void ControlButton::setSelected(uint8 selected) {
draw();
}
-Control::Control(SaveFileManager *saveFileMan, 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) {
_saveFileMan = saveFileMan;
_resMan = pResMan;
_objMan = pObjMan;
@@ -164,7 +164,6 @@ Control::Control(SaveFileManager *saveFileMan, ResMan *pResMan, ObjectMan *pObjM
_mouse = pMouse;
_music = pMusic;
_sound = pSound;
- strcpy(_savePath, savePath);
_lStrings = _languageStrings + SwordEngine::_systemVars.language * 20;
}
@@ -670,7 +669,7 @@ bool Control::restoreFromFile(void) {
void Control::readSavegameDescriptions(void) {
SaveFile *inf;
- inf = _saveFileMan->open_savefile("SAVEGAME.INF", _savePath, SAVEFILE_READ);
+ inf = _saveFileMan->openSavefile("SAVEGAME.INF", SAVEFILE_READ);
_saveScrollPos = _saveFiles = 0;
_selectedSavegame = 255;
if (inf && inf->isOpen()) {
@@ -713,11 +712,11 @@ int Control::displayMessage(const char *altButton, const char *message, ...) {
void Control::writeSavegameDescriptions(void) {
SaveFile *outf;
- outf = _saveFileMan->open_savefile("SAVEGAME.INF", _savePath, SAVEFILE_WRITE);
+ outf = _saveFileMan->openSavefile("SAVEGAME.INF", SAVEFILE_WRITE);
if (!outf) {
// Display an error message, and do nothing
- displayMessage(0, "Unable to write to path '%s'", _savePath);
+ displayMessage(0, "Unable to write to path '%s'", _saveFileMan->getSavePath());
return;
}
@@ -738,7 +737,7 @@ void Control::writeSavegameDescriptions(void) {
bool Control::savegamesExist(void) {
bool retVal = false;
SaveFile *inf;
- inf = _saveFileMan->open_savefile("SAVEGAME.INF", _savePath, SAVEFILE_READ);
+ inf = _saveFileMan->openSavefile("SAVEGAME.INF", SAVEFILE_READ);
if (inf && inf->isOpen())
retVal = true;
delete inf;
@@ -895,10 +894,10 @@ void Control::saveGameToFile(uint8 slot) {
sprintf(fName, "SAVEGAME.%03d", slot);
uint16 liveBuf[TOTAL_SECTIONS];
SaveFile *outf;
- outf = _saveFileMan->open_savefile(fName, _savePath, SAVEFILE_WRITE);
+ outf = _saveFileMan->openSavefile(fName, 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);
+ displayMessage(0, "Unable to create file '%s' in directory '%s'", fName, _saveFileMan->getSavePath());
return;
}
@@ -928,10 +927,10 @@ bool Control::restoreGameFromFile(uint8 slot) {
uint16 cnt;
sprintf(fName, "SAVEGAME.%03d", slot);
SaveFile *inf;
- inf = _saveFileMan->open_savefile(fName, _savePath, SAVEFILE_READ);
+ inf = _saveFileMan->openSavefile(fName, 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);
+ displayMessage(0, "Can't open file '%s' in directory '%s'", fName, _saveFileMan->getSavePath());
return false;
}
diff --git a/sword1/control.h b/sword1/control.h
index d57c32647b..017455f712 100644
--- a/sword1/control.h
+++ b/sword1/control.h
@@ -68,7 +68,7 @@ struct ButtonInfo {
class Control {
public:
- Control(SaveFileManager *saveFileMan, 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);
uint8 runPanel(void);
void doRestore(void);
void askForCd(void);
@@ -126,7 +126,6 @@ private:
Mouse *_mouse;
Music *_music;
Sound *_sound;
- char _savePath[256];
uint8 *_font, *_redFont;
uint8 *_screenBuf;
uint8 _keyPressed;
diff --git a/sword1/sword1.cpp b/sword1/sword1.cpp
index fa8d4d2258..f5f1e6d48e 100644
--- a/sword1/sword1.cpp
+++ b/sword1/sword1.cpp
@@ -201,7 +201,7 @@ int SwordEngine::init(GameDetector &detector) {
_logic->initialize();
_objectMan->initialize();
_mouse->initialize();
- _control = new Control(_saveFileMan, _resMan, _objectMan, _system, _mouse, _sound, _music, getSavePath());
+ _control = new Control(_saveFileMan, _resMan, _objectMan, _system, _mouse, _sound, _music);
return 0;
}