From 926ee25c9497a11c10b07301ee787378b6bc1f0f Mon Sep 17 00:00:00 2001 From: Dave White Date: Sat, 8 Nov 2003 19:52:41 +0000 Subject: [PATCH] allow use of escape to exit ok/cancel and yes/no dialogs with negative results --- src/show_dialog.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/show_dialog.cpp b/src/show_dialog.cpp index 4b7b0b53557..490ae22d577 100644 --- a/src/show_dialog.cpp +++ b/src/show_dialog.cpp @@ -501,6 +501,16 @@ int show_dialog(display& disp, SDL_Surface* image, return -1; } + if(!key_down && key[KEY_ESCAPE] && + (type == YES_NO || type == OK_CANCEL)) { + + if(menu_.height() == 0) { + return 1; + } else { + return -1; + } + } + if(menu_.selection() != cur_selection || first_time) { cur_selection = menu_.selection();