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

Function tty_curs

win/tty/wintty.c:2057–2158  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2055}
2056
2057void
2058tty_curs(
2059 winid window,
2060 int x, int y) /* coordinates (and curx-x) must be signed */
2061{
2062 struct WinDesc *cw = 0;
2063 int cx = ttyDisplay->curx;
2064 int cy = ttyDisplay->cury;
2065
2066 HUPSKIP();
2067 if (window == WIN_ERR || (cw = wins[window]) == (struct WinDesc *) 0)
2068 ttywindowpanic();
2069 ttyDisplay->lastwin = window;
2070
2071 print_vt_code2(AVTC_SELECT_WINDOW, window);
2072
2073#if defined(TILES_IN_GLYPHMAP) && defined(MSDOS)
2074 adjust_cursor_flags(cw);
2075#endif
2076
2077#ifdef DEBUG
2078 if (x < 1 || y < 0 || y >= cw->rows || x > cw->cols) {
2079 const char *s = "[unknown type]";
2080
2081 switch (cw->type) {
2082 case NHW_MESSAGE:
2083 s = "[topl window]";
2084 break;
2085 case NHW_STATUS:
2086 s = "[status window]";
2087 break;
2088 case NHW_MAP:
2089 s = "[map window]";
2090 break;
2091 case NHW_MENU:
2092 s = "[corner window]";
2093 break;
2094 case NHW_TEXT:
2095 s = "[text window]";
2096 break;
2097 case NHW_BASE:
2098 s = "[base window]";
2099 break;
2100 }
2101 /* avoid sending a line to the message window if we're complaining
2102 about cursor positioning in message window; perhaps raw_printf?
2103 this ought to be using impossible() so that someone might
2104 actually see it */
2105 if (cw->type != NHW_MESSAGE)
2106 debugpline4("tty_curs: bad positioning win %d %s <%d,%d>",
2107 window, s, x, y);
2108 /* don't try to fix up x,y here because then tty_curs() would
2109 behave differently depending on whether DEBUG is defined;
2110 garbage in, garbage out is the order of the day... */
2111 }
2112#endif /* DEBUG */
2113 cw->curx = --x; /* column 0 is not used */
2114 cw->cury = y;

Callers 15

addtoplFunction · 0.85
moreFunction · 0.85
topl_putsymFunction · 0.85
nocmovFunction · 0.85
cl_endFunction · 0.85
homeFunction · 0.85
cl_eosFunction · 0.85
resize_ttyFunction · 0.85
tty_init_nhwindowsFunction · 0.85
tty_asknameFunction · 0.85
erase_menu_or_textFunction · 0.85
tty_clear_nhwindowFunction · 0.85

Calls 4

adjust_cursor_flagsFunction · 0.85
end_glyphoutFunction · 0.85
cmovFunction · 0.70
nocmovFunction · 0.70

Tested by

no test coverage detected