MCPcopy Index your code
hub / github.com/NetHack/NetHack / flush_screen

Function flush_screen

src/display.c:2207–2267  ·  view source on GitHub ↗

* Synch the third screen with the display. */

Source from the content-addressed store, hash-verified

2205 * Synch the third screen with the display.
2206 */
2207void
2208flush_screen(int cursor_on_u)
2209{
2210 /* Prevent infinite loops on errors:
2211 * flush_screen->print_glyph->impossible->pline->flush_screen
2212 */
2213 static int flushing = 0;
2214 static int delay_flushing = 0;
2215 coordxy x, y;
2216 glyph_info bkglyphinfo = nul_glyphinfo;
2217 int bkglyph;
2218
2219 /* 5.0: don't update map, status, or perm_invent during save/restore */
2220 if (_suppress_map_output())
2221 return;
2222
2223 if (cursor_on_u == -1)
2224 delay_flushing = !delay_flushing;
2225 if (delay_flushing)
2226 return;
2227 if (flushing)
2228 return; /* if already flushing then return */
2229 flushing = 1;
2230#ifdef HANGUPHANDLING
2231 if (program_state.done_hup)
2232 return;
2233#endif
2234
2235 /* get this done now, before we place the cursor on the hero */
2236 if (disp.botl || disp.botlx)
2237 bot();
2238 else if (disp.time_botl)
2239 timebot();
2240
2241 for (y = 0; y < ROWNO; y++) {
2242 gbuf_entry *gptr = &gg.gbuf[y][x = gg.gbuf_start[y]];
2243
2244 for (; x <= gg.gbuf_stop[y]; gptr++, x++) {
2245 get_bkglyph_and_framecolor(x, y, &bkglyph,
2246 &bkglyphinfo.framecolor);
2247 if (gptr->gnew
2248 || (gw.wsettings.map_frame_color != NO_COLOR
2249 && bkglyphinfo.framecolor != NO_COLOR)) {
2250 /* map_glyphinfo() won't touch framecolor */
2251 map_glyphinfo(x, y, bkglyph, 0, &bkglyphinfo);
2252 print_glyph(WIN_MAP, x, y,
2253 Glyphinfo_at(x, y, gptr->glyphinfo.glyph),
2254 &bkglyphinfo);
2255 gptr->gnew = 0;
2256 }
2257 }
2258 }
2259 reset_glyph_bbox();
2260
2261 /* after map update, before display_nhwindow(WIN_MAP) */
2262 if (cursor_on_u)
2263 curs(WIN_MAP, u.ux, u.uy); /* move cursor to the hero */
2264

Callers 15

erase_menu_or_textFunction · 0.85
docornerFunction · 0.85
X11_getlinFunction · 0.85
ConvertKeyFunction · 0.85
doset_simpleFunction · 0.85
newgameFunction · 0.85
docallFunction · 0.85
do_mappingFunction · 0.85
do_vicinity_mapFunction · 0.85
ifFunction · 0.85
reveal_terrainFunction · 0.85
show_transient_lightFunction · 0.85

Calls 4

botFunction · 0.85
timebotFunction · 0.85
map_glyphinfoFunction · 0.85

Tested by

no test coverage detected