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

Function tty_display_nhwindow

win/tty/wintty.c:1854–1950  ·  view source on GitHub ↗

ARGSUSED*/

Source from the content-addressed store, hash-verified

1852
1853/*ARGSUSED*/
1854void
1855tty_display_nhwindow(
1856 winid window,
1857 boolean blocking) /* with ttys, all windows are blocking */
1858{
1859 struct WinDesc *cw = 0;
1860 short s_maxcol;
1861
1862 HUPSKIP();
1863 if (window == WIN_ERR || (cw = wins[window]) == (struct WinDesc *) 0)
1864 ttywindowpanic();
1865 if (cw->flags & WIN_CANCELLED)
1866 return;
1867 ttyDisplay->lastwin = window;
1868 ttyDisplay->rawprint = 0;
1869
1870 print_vt_code2(AVTC_SELECT_WINDOW, window);
1871
1872 switch (cw->type) {
1873 case NHW_MESSAGE:
1874 if (ttyDisplay->toplin == TOPLINE_NEED_MORE) {
1875 more();
1876 ttyDisplay->toplin = TOPLINE_NEED_MORE; /* more resets this */
1877 tty_clear_nhwindow(window);
1878 nhassert(ttyDisplay->toplin == TOPLINE_EMPTY);
1879 } else
1880 ttyDisplay->toplin = TOPLINE_EMPTY;
1881 cw->curx = cw->cury = 0;
1882 if (!cw->active)
1883 iflags.window_inited = TRUE;
1884 break;
1885 case NHW_MAP:
1886 end_glyphout();
1887 if (blocking) {
1888 if (ttyDisplay->toplin != TOPLINE_EMPTY)
1889 ttyDisplay->toplin = TOPLINE_NEED_MORE;
1890 tty_display_nhwindow(WIN_MESSAGE, TRUE);
1891 return;
1892 }
1893 FALLTHROUGH;
1894 /*FALLTHRU*/
1895 case NHW_BASE:
1896 (void) fflush(stdout);
1897 break;
1898 case NHW_TEXT:
1899 cw->maxcol = ttyDisplay->cols; /* force full-screen mode */
1900 FALLTHROUGH;
1901 /*FALLTHRU*/
1902 case NHW_MENU:
1903 cw->active = 1;
1904 /* cw->maxcol is a long, but its value is constrained to
1905 be <= ttyDisplay->cols, so is sure to fit within a short */
1906 s_maxcol = (short) cw->maxcol;
1907#ifdef H2344_BROKEN
1908 cw->offx = (cw->type == NHW_TEXT)
1909 ? 0
1910 : min(min(82, ttyDisplay->cols / 2),
1911 ttyDisplay->cols - s_maxcol - 1);

Callers 8

resize_ttyFunction · 0.85
tty_init_nhwindowsFunction · 0.85
tty_dismiss_nhwindowFunction · 0.85
tty_putstrFunction · 0.85
tty_display_fileFunction · 0.85
tty_select_menuFunction · 0.85
tty_wait_synchFunction · 0.85
mac_display_nhwindowFunction · 0.85

Calls 9

tty_clear_nhwindowFunction · 0.85
end_glyphoutFunction · 0.85
fflushFunction · 0.85
tty_cursFunction · 0.85
process_text_windowFunction · 0.85
process_menu_windowFunction · 0.85
moreFunction · 0.70
cl_eosFunction · 0.70
term_clear_screenFunction · 0.70

Tested by

no test coverage detected