diff options
Diffstat (limited to 'engines/drascula/saveload.cpp')
-rw-r--r-- | engines/drascula/saveload.cpp | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/engines/drascula/saveload.cpp b/engines/drascula/saveload.cpp index 15f5855bdc..664a082eb4 100644 --- a/engines/drascula/saveload.cpp +++ b/engines/drascula/saveload.cpp @@ -28,24 +28,23 @@ namespace Drascula { bool DrasculaEngine::saveLoadScreen() { char names[10][23]; - char file[50]; - char fileEpa[50]; + Common::String file; int n, n2, num_sav = 0, y = 27; Common::InSaveFile *sav; clearRoom(); - snprintf(fileEpa, 50, "%s.epa", _targetName.c_str()); + Common::String fileEpa = Common::String::format("%s.epa", _targetName.c_str()); if (!(sav = _saveFileMan->openForLoading(fileEpa))) { Common::OutSaveFile *epa; if (!(epa = _saveFileMan->openForSaving(fileEpa))) - error("Can't open %s file", fileEpa); + error("Can't open %s file", fileEpa.c_str()); for (n = 0; n < NUM_SAVES; n++) epa->writeString("*\n"); epa->finalize(); delete epa; if (!(sav = _saveFileMan->openForLoading(fileEpa))) { - error("Can't open %s file", fileEpa); + error("Can't open %s file", fileEpa.c_str()); } } for (n = 0; n < NUM_SAVES; n++) { @@ -88,11 +87,11 @@ bool DrasculaEngine::saveLoadScreen() { enterName(); strcpy(names[n], select); if (selectionMade == 1) { - snprintf(file, 50, "%s%02d", _targetName.c_str(), n + 1); - saveGame(file); + file = Common::String::format("%s%02d", _targetName.c_str(), n + 1); + saveGame(file.c_str()); Common::OutSaveFile *tsav; if (!(tsav = _saveFileMan->openForSaving(fileEpa))) { - error("Can't open %s file", fileEpa); + error("Can't open %s file", fileEpa.c_str()); } for (n = 0; n < NUM_SAVES; n++) { tsav->writeString(names[n]); @@ -110,7 +109,7 @@ bool DrasculaEngine::saveLoadScreen() { y = y + 9; } if (selectionMade == 1) { - snprintf(file, 50, "%s%02d", _targetName.c_str(), n + 1); + file = Common::String::format("%s%02d", _targetName.c_str(), n + 1); } num_sav = n; } @@ -127,11 +126,11 @@ bool DrasculaEngine::saveLoadScreen() { } if (selectionMade == 1) { - snprintf(file, 50, "%s%02d", _targetName.c_str(), n + 1); - saveGame(file); + file = Common::String::format("%s%02d", _targetName.c_str(), n + 1); + saveGame(file.c_str()); Common::OutSaveFile *tsav; if (!(tsav = _saveFileMan->openForSaving(fileEpa))) { - error("Can't open %s file", fileEpa); + error("Can't open %s file", fileEpa.c_str()); } for (n = 0; n < NUM_SAVES; n++) { tsav->writeString(names[n]); @@ -143,16 +142,16 @@ bool DrasculaEngine::saveLoadScreen() { } if (mouseX > 125 && mouseY > 123 && mouseX < 199 && mouseY < 149 && selectionMade == 1) { - if (!loadGame(file)) { + if (!loadGame(file.c_str())) { _system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false); return false; } break; } else if (mouseX > 208 && mouseY > 123 && mouseX < 282 && mouseY < 149 && selectionMade == 1) { - saveGame(file); + saveGame(file.c_str()); Common::OutSaveFile *tsav; if (!(tsav = _saveFileMan->openForSaving(fileEpa))) { - error("Can't open %s file", fileEpa); + error("Can't open %s file", fileEpa.c_str()); } for (n = 0; n < NUM_SAVES; n++) { tsav->writeString(names[n]); @@ -229,7 +228,7 @@ bool DrasculaEngine::loadGame(const char *gameName) { return true; } -void DrasculaEngine::saveGame(char gameName[]) { +void DrasculaEngine::saveGame(const char *gameName) { Common::OutSaveFile *out; int l; |