| 2223 | } |
| 2224 | |
| 2225 | void |
| 2226 | tty_putstr(winid window, int attr, const char *str) |
| 2227 | { |
| 2228 | struct WinDesc *cw = 0; |
| 2229 | char *ob; |
| 2230 | long i, n0; |
| 2231 | #ifndef STATUS_HILITES |
| 2232 | const char *nb; |
| 2233 | long j; |
| 2234 | #endif |
| 2235 | |
| 2236 | HUPSKIP(); |
| 2237 | /* Assume there's a real problem if the window is missing -- |
| 2238 | * probably a panic message |
| 2239 | */ |
| 2240 | if (window == WIN_ERR || (cw = wins[window]) == (struct WinDesc *) 0) { |
| 2241 | tty_raw_print(str); |
| 2242 | return; |
| 2243 | } |
| 2244 | |
| 2245 | if (str == (const char *) 0 |
| 2246 | || ((cw->flags & WIN_CANCELLED) && (cw->type != NHW_MESSAGE))) |
| 2247 | return; |
| 2248 | if (cw->type != NHW_MESSAGE |
| 2249 | #ifdef TTY_PERM_INVENT |
| 2250 | && window != WIN_INVEN |
| 2251 | #endif |
| 2252 | ) |
| 2253 | str = compress_str(str); |
| 2254 | |
| 2255 | ttyDisplay->lastwin = window; |
| 2256 | |
| 2257 | print_vt_code2(AVTC_SELECT_WINDOW, window); |
| 2258 | |
| 2259 | switch (cw->type) { |
| 2260 | case NHW_MESSAGE: { |
| 2261 | int suppress_history = (attr & ATR_NOHISTORY), |
| 2262 | urgent_message = (attr & ATR_URGENT); |
| 2263 | |
| 2264 | #if defined(ASCIIGRAPH) && !defined(NO_TERMS) |
| 2265 | /* if ^C occurs, player is prompted with "Really quit?" and that |
| 2266 | prompt is issued via tty_putstr(WIN_MESSAGE); if ^C happens |
| 2267 | while writing DECgraphics chars, the prompt text would be |
| 2268 | rendered as VT line-drawing characters unless we do this; |
| 2269 | also, if color was in progress it wouldn't be switched off */ |
| 2270 | end_glyphout(); |
| 2271 | #endif |
| 2272 | /* if message is designated 'urgent' don't suppress it if user has |
| 2273 | typed ESC at --More-- prompt when dismissing an earlier message; |
| 2274 | besides turning off WIN_STOP, we need to prevent current message |
| 2275 | from provoking --More-- and giving the user another chance at |
| 2276 | using ESC to suppress, otherwise this message wouldn't get shown */ |
| 2277 | if (urgent_message) { |
| 2278 | if ((cw->flags & WIN_STOP) != 0) { |
| 2279 | tty_clear_nhwindow(WIN_MESSAGE); |
| 2280 | cw->flags &= ~WIN_STOP; |
| 2281 | } |
| 2282 | cw->flags |= WIN_NOSTOP; |
no test coverage detected