diff options
author | Matthew Hoops | 2014-04-13 09:22:55 -0400 |
---|---|---|
committer | Matthew Hoops | 2014-04-13 09:27:13 -0400 |
commit | fb658c396980ec6e4d303cd50da06754c653d0c9 (patch) | |
tree | 0c351f81540efed56e137cb1813f935344bd57cc | |
parent | ac9182181d899d66ba6317e3e51dc781961ba239 (diff) | |
download | scummvm-rg350-fb658c396980ec6e4d303cd50da06754c653d0c9.tar.gz scummvm-rg350-fb658c396980ec6e4d303cd50da06754c653d0c9.tar.bz2 scummvm-rg350-fb658c396980ec6e4d303cd50da06754c653d0c9.zip |
PEGASUS: Fix showing save failed dialog when not using the GMM
-rw-r--r-- | engines/pegasus/pegasus.cpp | 37 | ||||
-rw-r--r-- | engines/pegasus/pegasus.h | 1 |
2 files changed, 26 insertions, 12 deletions
diff --git a/engines/pegasus/pegasus.cpp b/engines/pegasus/pegasus.cpp index c5edd34a01..978cb24790 100644 --- a/engines/pegasus/pegasus.cpp +++ b/engines/pegasus/pegasus.cpp @@ -36,6 +36,7 @@ #include "backends/keymapper/keymapper.h" #include "base/plugins.h" #include "base/version.h" +#include "gui/message.h" #include "gui/saveload.h" #include "video/theora_decoder.h" #include "video/qt_decoder.h" @@ -379,20 +380,21 @@ Common::Error PegasusEngine::showSaveDialog() { int slot = slc.runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName()); - Common::Error result; + if (slot >= 0) + return saveGameState(slot, slc.getResultString()); - if (slot >= 0) { - if (saveGameState(slot, slc.getResultString()).getCode() == Common::kNoError) - result = Common::kNoError; - else - result = Common::kUnknownError; - } else { - result = Common::kUserCanceled; - } + return Common::kUserCanceled; +} - return result; +void PegasusEngine::showSaveFailedDialog(const Common::Error &status) { + 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(); } + GUI::Debugger *PegasusEngine::getDebugger() { return _console; } @@ -969,8 +971,14 @@ void PegasusEngine::doGameMenuCommand(const GameMenuCommand command) { resetIntroTimer(); break; case kMenuCmdPauseSave: - if (showSaveDialog().getCode() != Common::kUserCanceled) + result = showSaveDialog(); + + if (result.getCode() != Common::kUserCanceled) { + if (result.getCode() != Common::kNoError) + showSaveFailedDialog(result); + pauseMenu(false); + } break; case kMenuCmdPauseContinue: pauseMenu(false); @@ -1021,7 +1029,12 @@ void PegasusEngine::handleInput(const Input &input, const Hotspot *cursorSpot) { // Can only save during a game and not in the demo if (g_neighborhood && !isDemo()) { pauseEngine(true); - showSaveDialog(); + + Common::Error result = showSaveDialog(); + + if (result.getCode() != Common::kNoError && result.getCode() != Common::kUserCanceled) + showSaveFailedDialog(result); + pauseEngine(false); } } diff --git a/engines/pegasus/pegasus.h b/engines/pegasus/pegasus.h index fb66eb7586..d88545a4d1 100644 --- a/engines/pegasus/pegasus.h +++ b/engines/pegasus/pegasus.h @@ -257,6 +257,7 @@ private: bool _saveAllowed, _loadAllowed; // It's so nice that this was in the original code already :P Common::Error showLoadDialog(); Common::Error showSaveDialog(); + void showSaveFailedDialog(const Common::Error &status); bool _saveRequested, _loadRequested; // Misc. |