diff options
author | Max Horn | 2003-12-14 20:36:37 +0000 |
---|---|---|
committer | Max Horn | 2003-12-14 20:36:37 +0000 |
commit | 5e000ec43f771155f9ecc605c60d39511661d908 (patch) | |
tree | 7bd7ac7356a4d16ce7f633387542af0ce8d9eec8 /scumm | |
parent | e1c21c2d8c3ba05ba32bf86f2fa66e5786264f52 (diff) | |
download | scummvm-rg350-5e000ec43f771155f9ecc605c60d39511661d908.tar.gz scummvm-rg350-5e000ec43f771155f9ecc605c60d39511661d908.tar.bz2 scummvm-rg350-5e000ec43f771155f9ecc605c60d39511661d908.zip |
Let's spell it out: c-o-d-e r-e-u-s-e :-)
svn-id: r11640
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/dialogs.cpp | 24 | ||||
-rw-r--r-- | scumm/dialogs.h | 16 | ||||
-rw-r--r-- | scumm/scumm.h | 2 | ||||
-rw-r--r-- | scumm/scummvm.cpp | 16 |
4 files changed, 15 insertions, 43 deletions
diff --git a/scumm/dialogs.cpp b/scumm/dialogs.cpp index 6e5cc20fe2..33309812ab 100644 --- a/scumm/dialogs.cpp +++ b/scumm/dialogs.cpp @@ -606,30 +606,22 @@ PauseDialog::PauseDialog(ScummEngine *scumm) : InfoDialog(scumm, 10) { } -ConfirmExitDialog::ConfirmExitDialog(ScummEngine *scumm) - : InfoDialog(scumm, "Do you really want to quit (y/n)?") { -} - -void ConfirmExitDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) { - if (tolower(ascii) == 'n') { // Close exit dialog if n key is pressed - setResult(0); +void PauseDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) { + if (ascii == ' ') // Close pause dialog if space key is pressed close(); - } else if (tolower(ascii) == 'y') { // Quit if y key is pressed - setResult(1); - close(); - } else + else ScummDialog::handleKeyDown(ascii, keycode, modifiers); } -ConfirmRestartDialog::ConfirmRestartDialog(ScummEngine *scumm) - : InfoDialog(scumm, "Do you really want to restart (y/n)?") { +ConfirmDialog::ConfirmDialog(ScummEngine *scumm, const String& message) + : InfoDialog(scumm, message) { } -void ConfirmRestartDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) { - if (tolower(ascii) == 'n') { // Close restart dialog if n key is pressed +void ConfirmDialog::handleKeyDown(uint16 ascii, int keycode, int modifiers) { + if (tolower(ascii) == 'n') { setResult(0); close(); - } else if (tolower(ascii) == 'y') { // Restart if y key is pressed + } else if (tolower(ascii) == 'y') { setResult(1); close(); } else diff --git a/scumm/dialogs.h b/scumm/dialogs.h index 0d9c8a25c1..3e05327cf9 100644 --- a/scumm/dialogs.h +++ b/scumm/dialogs.h @@ -142,24 +142,12 @@ protected: class PauseDialog : public InfoDialog { public: PauseDialog(ScummEngine *scumm); - virtual void handleKeyDown(uint16 ascii, int keycode, int modifiers) - { - if (ascii == ' ') // Close pause dialog if space key is pressed - close(); - else - ScummDialog::handleKeyDown(ascii, keycode, modifiers); - } -}; - -class ConfirmExitDialog : public InfoDialog { -public: - ConfirmExitDialog(ScummEngine *scumm); virtual void handleKeyDown(uint16 ascii, int keycode, int modifiers); }; -class ConfirmRestartDialog : public InfoDialog { +class ConfirmDialog : public InfoDialog { public: - ConfirmRestartDialog(ScummEngine *scumm); + ConfirmDialog(ScummEngine *scumm, const String& message); virtual void handleKeyDown(uint16 ascii, int keycode, int modifiers); }; diff --git a/scumm/scumm.h b/scumm/scumm.h index fb20f01c8d..7677019072 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -351,8 +351,6 @@ protected: Dialog *_pauseDialog; Dialog *_optionsDialog; Dialog *_mainMenuDialog; - Dialog *_confirmExitDialog; - Dialog *_confirmRestartDialog; protected: int runDialog(Dialog &dialog); diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp index e8f9dcf8cc..a6c2ccf3bf 100644 --- a/scumm/scummvm.cpp +++ b/scumm/scummvm.cpp @@ -326,8 +326,6 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS _pauseDialog = NULL; _optionsDialog = NULL; _mainMenuDialog = NULL; - _confirmExitDialog = NULL; - _confirmRestartDialog = NULL; _fastMode = 0; _actors = NULL; _inventory = NULL; @@ -862,8 +860,6 @@ ScummEngine::~ScummEngine() { delete _pauseDialog; delete _optionsDialog; delete _mainMenuDialog; - delete _confirmExitDialog; - delete _confirmRestartDialog; delete _sound; if (_musicEngine) { @@ -1699,7 +1695,7 @@ void ScummEngine::parseEvents() { if (_confirmExit) confirmexitDialog(); else - _quit = true; + _quit = true; break; default: @@ -2577,19 +2573,17 @@ void ScummEngine::optionsDialog() { } void ScummEngine::confirmexitDialog() { - if (!_confirmExitDialog) - _confirmExitDialog = new ConfirmExitDialog(this); + ConfirmDialog confirmExitDialog(this, "Do you really want to quit (y/n)?"); - if (runDialog(*_confirmExitDialog)) { + if (runDialog(confirmExitDialog)) { _quit = true; } } void ScummEngine::confirmrestartDialog() { - if (!_confirmRestartDialog) - _confirmRestartDialog = new ConfirmRestartDialog(this); + ConfirmDialog confirmRestartDialog(this, "Do you really want to restart (y/n)?"); - if (runDialog(*_confirmRestartDialog)) { + if (runDialog(confirmRestartDialog)) { restart(); } } |