Ticket #5350: scumm_confirm_dialog.patch

File scumm_confirm_dialog.patch, 1.3 KB (added by lordhoto, 14 years ago)

Patch against r52679

  • engines/scumm/dialogs.cpp

    diff --git a/engines/scumm/dialogs.cpp b/engines/scumm/dialogs.cpp
    index 1e0bf6d..a48e54c 100644
    a b void PauseDialog::handleKeyDown(Common::KeyState state) {  
    473473}
    474474
    475475ConfirmDialog::ConfirmDialog(ScummEngine *scumm, int res)
    476         : InfoDialog(scumm, res) {
     476        : InfoDialog(scumm, res), _yesKey('y'), _noKey('n') {
     477
     478        if (_message.lastChar() != ')') {
     479                _yesKey = _message.lastChar();
     480                _message.deleteLastChar();
     481
     482                if (_yesKey >= 'A' && _yesKey <= 'Z')
     483                        _yesKey += 'a' - 'A';
     484
     485                _text->setLabel(_message);
     486                reflowLayout();
     487        }
    477488}
    478489
    479490void ConfirmDialog::handleKeyDown(Common::KeyState state) {
    480         if (state.keycode == Common::KEYCODE_n) {
     491        if (state.keycode == Common::KEYCODE_n || state.ascii == _noKey) {
    481492                setResult(0);
    482493                close();
    483         } else if (state.keycode == Common::KEYCODE_y) {
     494        } else if (state.keycode == Common::KEYCODE_y || state.ascii == _yesKey) {
    484495                setResult(1);
    485496                close();
    486497        } else
  • engines/scumm/dialogs.h

    diff --git a/engines/scumm/dialogs.h b/engines/scumm/dialogs.h
    index 41a8ec8..0e6e189 100644
    a b class ConfirmDialog : public InfoDialog {  
    118118public:
    119119        ConfirmDialog(ScummEngine *scumm, int res);
    120120        virtual void handleKeyDown(Common::KeyState state);
     121
     122protected:
     123        char _yesKey, _noKey;
    121124};
    122125
    123126/**