From: warwick Date: Sun, 13 Jan 2002 00:33:02 +0000 (+0000) Subject: Fix YN function in Qt windowport compact mode (wasn't parsing properly). X-Git-Tag: MOVE2GIT~3493 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=15e5fc1a958db99e2a8ae60e3201e4b4010ca1de;p=nethack Fix YN function in Qt windowport compact mode (wasn't parsing properly). Often, the yn_function "choices" parameter is not set, so for a non-keyboard GUI (compact mode is for handheld computers with a stylus), the windowport has to parse the prompt to find out the posible input choices. I got the parsing wrong. --- diff --git a/win/Qt/qt_win.cpp b/win/Qt/qt_win.cpp index 5aba22bf3..c9e4302ad 100644 --- a/win/Qt/qt_win.cpp +++ b/win/Qt/qt_win.cpp @@ -3946,6 +3946,7 @@ char NetHackQtYnDialog::Exec() QString enable; if ( qt_compact_mode && !choices ) { // expand choices from prompt + // ##### why isn't choices set properly??? const char* c=question; while ( *c && *c != '[' ) c++; @@ -3956,13 +3957,16 @@ char NetHackQtYnDialog::Exec() ch.append(*c++); char from=0; while ( *c && *c != ']' && *c != ' ' ) { - if ( *c == '-' ) + if ( *c == '-' ) { from = c[-1]; - else if ( from ) - for (char f=from; f<=*c; f++) + } else if ( from ) { + for (char f=from+1; f<=*c; f++) ch.append(f); - else + from = 0; + } else { ch.append(*c); + from = 0; + } c++; } if ( *c == ' ' ) { @@ -4415,8 +4419,10 @@ NetHackQtSavedGameSelector::NetHackQtSavedGameSelector(const char** saved) : int NetHackQtSavedGameSelector::choose() { +#if defined(QWS) // probably safe with Qt 3, too (where show!=exec in QDialog). if ( qt_compact_mode ) showMaximized(); +#endif return exec()-2; }