diff options
author | D G Turner | 2012-02-21 22:30:29 +0000 |
---|---|---|
committer | D G Turner | 2012-02-21 22:30:29 +0000 |
commit | aa26d5def4265d496c03ef81fb2aa128020b08d4 (patch) | |
tree | b84bb88c601c92c5bda73f37fba0ec0ebe0c1760 /engines/dialogs.cpp | |
parent | 7986f1709d77a84df92ba86ecf04a0cb1e88e0cf (diff) | |
download | scummvm-rg350-aa26d5def4265d496c03ef81fb2aa128020b08d4.tar.gz scummvm-rg350-aa26d5def4265d496c03ef81fb2aa128020b08d4.tar.bz2 scummvm-rg350-aa26d5def4265d496c03ef81fb2aa128020b08d4.zip |
ENGINES: Add error handling for GMM Gamestate Load/Save Usage.
As indicated by wjp, the Global Main Menu (GMM) did not check or report
on the returned error state from saveGameState() and loadGameState() usage.
This corrects this and adds a MessageDialog report of any failure.
Diffstat (limited to 'engines/dialogs.cpp')
-rw-r--r-- | engines/dialogs.cpp | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/engines/dialogs.cpp b/engines/dialogs.cpp index 435576e9e4..1b54c7e26a 100644 --- a/engines/dialogs.cpp +++ b/engines/dialogs.cpp @@ -227,19 +227,24 @@ void MainMenuDialog::save() { Common::String result(_saveDialog->getResultString()); if (result.empty()) { // If the user was lazy and entered no save name, come up with a default name. - Common::String buf; #if defined(USE_SAVEGAME_TIMESTAMP) TimeDate curTime; g_system->getTimeAndDate(curTime); curTime.tm_year += 1900; // fixup year curTime.tm_mon++; // fixup month - buf = Common::String::format("%04d.%02d.%02d / %02d:%02d:%02d", curTime.tm_year, curTime.tm_mon, curTime.tm_mday, curTime.tm_hour, curTime.tm_min, curTime.tm_sec); + result = Common::String::format("%04d.%02d.%02d / %02d:%02d:%02d", curTime.tm_year, curTime.tm_mon, curTime.tm_mday, curTime.tm_hour, curTime.tm_min, curTime.tm_sec); #else - buf = Common::String::format("Save %d", slot + 1); + result = Common::String::format("Save %d", slot + 1); #endif - _engine->saveGameState(slot, buf); - } else { - _engine->saveGameState(slot, result); + } + + Common::Error status = _engine->saveGameState(slot, result); + if (status.getCode() != Common::kNoError) { + Common::String failMessage = Common::String::format(_("Gamestate save failed (%s)! " + "Please consult the README for basic information, and for " + "instructions on how to obtain further assistance."), status.getDesc().c_str()); + GUI::MessageDialog dialog(failMessage); + dialog.runModal(); } close(); @@ -256,7 +261,7 @@ void MainMenuDialog::load() { _engine->setGameToLoadSlot(slot); - if (slot >= 0) + if (slot >= 0) close(); } |