| 75 | } |
| 76 | |
| 77 | char NetHackQtYnDialog::Exec() |
| 78 | { |
| 79 | QString ch(QString::fromLatin1(choices)); |
| 80 | // int ch_per_line=6; |
| 81 | QString qlabel; |
| 82 | QString enable; |
| 83 | if ( qt_compact_mode && !choices ) { |
| 84 | ch = ""; |
| 85 | // expand choices from prompt |
| 86 | // ##### why isn't choices set properly??? |
| 87 | int c = question.indexOf(QChar('[')); |
| 88 | qlabel = QString(question).left(c); |
| 89 | if ( c >= 0 ) { |
| 90 | c++; |
| 91 | if ( question[c] == '-' ) |
| 92 | ch.append(question[c++]); |
| 93 | unsigned from=0; |
| 94 | while (c < question.size() |
| 95 | && question[c] != ']' && question[c] != ' ') { |
| 96 | if ( question[c] == '-' ) { |
| 97 | from = question[c - 1].cell(); |
| 98 | } else if ( from != 0 ) { |
| 99 | for (unsigned f=from+1; QChar(f)<=question[c]; f++) |
| 100 | ch.append(QChar(f)); |
| 101 | from = 0; |
| 102 | } else { |
| 103 | ch.append(question[c]); |
| 104 | from = 0; |
| 105 | } |
| 106 | c++; |
| 107 | } |
| 108 | if ( question[c] == ' ' ) { |
| 109 | while ( c < question.size() && question[c] != ']' ) { |
| 110 | if ( question[c] == '*' || question[c] == '?' ) |
| 111 | ch.append(question[c]); |
| 112 | c++; |
| 113 | } |
| 114 | } |
| 115 | } |
| 116 | if ( question.indexOf("what direction") >= 0 ) { |
| 117 | // We replace this regardless, since sometimes you get choices. |
| 118 | const char* d = gc.Cmd.dirchars; |
| 119 | enable=ch; |
| 120 | ch=""; |
| 121 | ch.append(d[1]); |
| 122 | ch.append(d[2]); |
| 123 | ch.append(d[3]); |
| 124 | ch.append(d[0]); |
| 125 | ch.append('.'); |
| 126 | ch.append(d[4]); |
| 127 | ch.append(d[7]); |
| 128 | ch.append(d[6]); |
| 129 | ch.append(d[5]); |
| 130 | ch.append(d[8]); |
| 131 | ch.append(d[9]); |
| 132 | // ch_per_line = 3; |
| 133 | def = ' '; |
| 134 | } else { |
no test coverage detected