diff options
author | Eugene Sandulenko | 2019-07-17 12:13:48 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:17:22 +0200 |
commit | 2909d9a9a0e11b39a77632dcf82c709304aa098a (patch) | |
tree | 23d68c7ec69c0d9acfa60932f4111844b69450df /engines/hdb/saveload.cpp | |
parent | 345830222d0311d2f72cd932884838976687c6fa (diff) | |
download | scummvm-rg350-2909d9a9a0e11b39a77632dcf82c709304aa098a.tar.gz scummvm-rg350-2909d9a9a0e11b39a77632dcf82c709304aa098a.tar.bz2 scummvm-rg350-2909d9a9a0e11b39a77632dcf82c709304aa098a.zip |
HDB: Move save filename generation to genSaveFileName()
Diffstat (limited to 'engines/hdb/saveload.cpp')
-rw-r--r-- | engines/hdb/saveload.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/engines/hdb/saveload.cpp b/engines/hdb/saveload.cpp index acda89222e..5c59619aba 100644 --- a/engines/hdb/saveload.cpp +++ b/engines/hdb/saveload.cpp @@ -32,7 +32,7 @@ Common::Error HDBGame::saveGameState(int slot, const Common::String &desc) { Common::OutSaveFile *out; - Common::String saveFileName = Common::String::format("%s.%03d", _targetName.c_str(), slot); + Common::String saveFileName = genSaveFileName(slot, false); if (!(out = _saveFileMan->openForSaving(saveFileName))) error("Unable to open save file"); @@ -45,7 +45,7 @@ Common::Error HDBGame::saveGameState(int slot, const Common::String &desc) { // Actual Save Data saveGame(out); - _lua->save(out, _targetName.c_str(), slot); + _lua->save(out, slot); out->finalize(); if (out->err()) @@ -59,7 +59,7 @@ Common::Error HDBGame::saveGameState(int slot, const Common::String &desc) { Common::Error HDBGame::loadGameState(int slot) { Common::InSaveFile *in; - Common::String saveFileName = Common::String::format("%s.%03d", _targetName.c_str(), slot); + Common::String saveFileName = genSaveFileName(slot, false); if (!(in = _saveFileMan->openForLoading(saveFileName))) { warning("missing savegame file %s", saveFileName.c_str()); if (g_hdb->_map->isLoaded()) @@ -76,7 +76,7 @@ Common::Error HDBGame::loadGameState(int slot) { _lua->loadLua(_currentLuaName); // load the Lua code FIRST! (if no file, it's ok) - saveFileName = Common::String::format("%s.l.%03d", _targetName.c_str(), slot); + saveFileName = genSaveFileName(slot, true); _lua->loadSaveFile(in, saveFileName.c_str()); delete in; @@ -340,5 +340,12 @@ void AIEntity::load(Common::InSaveFile *in) { aiDraw = drawf; } +Common::String HDBGame::genSaveFileName(uint slot, bool lua) { + if (!lua) + return Common::String::format("%s.%03d", _targetName.c_str(), slot); + + return Common::String::format("%s.l.%03d", _targetName.c_str(), slot); +} + } // End of Namespace |