| 4091 | } |
| 4092 | |
| 4093 | char NetHackQtYnDialog::Exec() |
| 4094 | { |
| 4095 | QString ch(choices); |
| 4096 | int ch_per_line=6; |
| 4097 | QString qlabel; |
| 4098 | QString enable; |
| 4099 | if ( qt_compact_mode && !choices ) { |
| 4100 | // expand choices from prompt |
| 4101 | // ##### why isn't choices set properly??? |
| 4102 | const char* c=question; |
| 4103 | while ( *c && *c != '[' ) |
| 4104 | c++; |
| 4105 | qlabel = QString(question).left(c-question); |
| 4106 | if ( *c ) { |
| 4107 | c++; |
| 4108 | if ( *c == '-' ) |
| 4109 | ch.append(*c++); |
| 4110 | char from=0; |
| 4111 | while ( *c && *c != ']' && *c != ' ' ) { |
| 4112 | if ( *c == '-' ) { |
| 4113 | from = c[-1]; |
| 4114 | } else if ( from ) { |
| 4115 | for (char f=from+1; f<=*c; f++) |
| 4116 | ch.append(f); |
| 4117 | from = 0; |
| 4118 | } else { |
| 4119 | ch.append(*c); |
| 4120 | from = 0; |
| 4121 | } |
| 4122 | c++; |
| 4123 | } |
| 4124 | if ( *c == ' ' ) { |
| 4125 | while ( *c && *c != ']' ) { |
| 4126 | if ( *c == '*' || *c == '?' ) |
| 4127 | ch.append(*c); |
| 4128 | c++; |
| 4129 | } |
| 4130 | } |
| 4131 | } |
| 4132 | if ( strstr(question, "what direction") ) { |
| 4133 | // We replace this regardless, since sometimes you get choices. |
| 4134 | const char* d = Cmd.dirchars; |
| 4135 | enable=ch; |
| 4136 | ch=""; |
| 4137 | ch.append(d[1]); |
| 4138 | ch.append(d[2]); |
| 4139 | ch.append(d[3]); |
| 4140 | ch.append(d[0]); |
| 4141 | ch.append('.'); |
| 4142 | ch.append(d[4]); |
| 4143 | ch.append(d[7]); |
| 4144 | ch.append(d[6]); |
| 4145 | ch.append(d[5]); |
| 4146 | ch.append(d[8]); |
| 4147 | ch.append(d[9]); |
| 4148 | ch_per_line = 3; |
| 4149 | def = ' '; |
| 4150 | } else { |
no test coverage detected