diff options
author | Travis Howell | 2003-12-14 15:04:05 +0000 |
---|---|---|
committer | Travis Howell | 2003-12-14 15:04:05 +0000 |
commit | 2556f9b77ad4b210e19c403e1270f9d3393e27ff (patch) | |
tree | 08c466cdfd460c24254f4e987483085a8bfc9959 /scumm | |
parent | cbcca65d067e576d46bd15b1240138524516bfb4 (diff) | |
download | scummvm-rg350-2556f9b77ad4b210e19c403e1270f9d3393e27ff.tar.gz scummvm-rg350-2556f9b77ad4b210e19c403e1270f9d3393e27ff.tar.bz2 scummvm-rg350-2556f9b77ad4b210e19c403e1270f9d3393e27ff.zip |
Always confirm restart
svn-id: r11635
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/dialogs.cpp | 15 | ||||
-rw-r--r-- | scumm/dialogs.h | 6 | ||||
-rw-r--r-- | scumm/scumm.h | 2 | ||||
-rw-r--r-- | scumm/scummvm.cpp | 13 |
4 files changed, 35 insertions, 1 deletions
diff --git a/scumm/dialogs.cpp b/scumm/dialogs.cpp index 4124a0d477..8ff15d9eb4 100644 --- a/scumm/dialogs.cpp +++ b/scumm/dialogs.cpp @@ -621,6 +621,21 @@ void ConfirmExitDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) ScummDialog::handleKeyDown(ascii, keycode, modifiers); } +ConfirmRestartDialog::ConfirmRestartDialog(ScummEngine *scumm) + : InfoDialog(scumm, "Do you really want to quit (y/n)?") { +} + +void ConfirmRestartDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) { + if (tolower(ascii) == 'n') { // Close exit dialog if n key is pressed + setResult(0); + close(); + } else if (tolower(ascii) == 'y') { // Quit if y key is pressed + setResult(1); + close(); + } else + ScummDialog::handleKeyDown(ascii, keycode, modifiers); +} + #ifdef _WIN32_WCE #pragma mark - diff --git a/scumm/dialogs.h b/scumm/dialogs.h index ca495e7c5a..0d9c8a25c1 100644 --- a/scumm/dialogs.h +++ b/scumm/dialogs.h @@ -157,6 +157,12 @@ public: virtual void handleKeyDown(uint16 ascii, int keycode, int modifiers); }; +class ConfirmRestartDialog : public InfoDialog { +public: + ConfirmRestartDialog(ScummEngine *scumm); + virtual void handleKeyDown(uint16 ascii, int keycode, int modifiers); +}; + #ifdef _WIN32_WCE class KeysDialog : public ScummDialog { diff --git a/scumm/scumm.h b/scumm/scumm.h index 5e1765b731..fb20f01c8d 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -352,10 +352,12 @@ protected: Dialog *_optionsDialog; Dialog *_mainMenuDialog; Dialog *_confirmExitDialog; + Dialog *_confirmRestartDialog; protected: int runDialog(Dialog &dialog); void confirmexitDialog(); + void confirmrestartDialog(); void pauseDialog(); void mainMenuDialog(); public: diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp index a5d2805218..e8f9dcf8cc 100644 --- a/scumm/scummvm.cpp +++ b/scumm/scummvm.cpp @@ -327,6 +327,7 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS _optionsDialog = NULL; _mainMenuDialog = NULL; _confirmExitDialog = NULL; + _confirmRestartDialog = NULL; _fastMode = 0; _actors = NULL; _inventory = NULL; @@ -862,6 +863,7 @@ ScummEngine::~ScummEngine() { delete _optionsDialog; delete _mainMenuDialog; delete _confirmExitDialog; + delete _confirmRestartDialog; delete _sound; if (_musicEngine) { @@ -1844,7 +1846,7 @@ void ScummEngine::processKbd() { #endif if (VAR_RESTART_KEY != 0xFF && _lastKeyHit == VAR(VAR_RESTART_KEY)) { - restart(); + confirmrestartDialog(); return; } @@ -2583,6 +2585,15 @@ void ScummEngine::confirmexitDialog() { } } +void ScummEngine::confirmrestartDialog() { + if (!_confirmRestartDialog) + _confirmRestartDialog = new ConfirmRestartDialog(this); + + if (runDialog(*_confirmRestartDialog)) { + restart(); + } +} + char ScummEngine::displayError(bool showCancel, const char *message, ...) { #ifdef __PALM_OS__ char buf[256]; // 1024 is too big overflow the stack |