MCPcopy Create free account
hub / github.com/NetHack/NetHack / tty_putstr

Function tty_putstr

win/tty/wintty.c:2225–2422  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2223}
2224
2225void
2226tty_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;

Callers 6

tty_init_nhwindowsFunction · 0.85
tty_asknameFunction · 0.85
tty_display_fileFunction · 0.85
tty_message_menuFunction · 0.85
tty_putmixedFunction · 0.85
mac_putstrFunction · 0.85

Calls 14

tty_raw_printFunction · 0.85
compress_strFunction · 0.85
end_glyphoutFunction · 0.85
tty_clear_nhwindowFunction · 0.85
update_toplFunction · 0.85
remember_toplFunction · 0.85
show_toplFunction · 0.85
tty_cursFunction · 0.85
tty_putsymFunction · 0.85
tty_display_nhwindowFunction · 0.85
cl_endFunction · 0.70
term_start_attrFunction · 0.70

Tested by

no test coverage detected