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

Function magic_map_background

src/display.c:232–258  ·  view source on GitHub ↗

* magic_map_background() * * This function is similar to map_background (see below) except we pay * attention to and correct unexplored, lit ROOM and CORR spots. */

Source from the content-addressed store, hash-verified

230 * attention to and correct unexplored, lit ROOM and CORR spots.
231 */
232void
233magic_map_background(coordxy x, coordxy y, int show)
234{
235 int glyph = back_to_glyph(x, y); /* assumes hero can see x,y */
236 struct rm *lev = &levl[x][y];
237
238 /*
239 * Correct for out of sight lit corridors and rooms that the hero
240 * doesn't remember as lit.
241 */
242 if (!cansee(x, y) && !lev->waslit) {
243 /* Floor spaces are dark if unlit. Corridors are dark if unlit. */
244 if (lev->typ == ROOM && glyph == cmap_to_glyph(S_room))
245 glyph = (flags.dark_room && iflags.use_color)
246 ? cmap_to_glyph(DARKROOMSYM)
247 : GLYPH_NOTHING;
248 else if (lev->typ == CORR && glyph == cmap_to_glyph(S_litcorr))
249 glyph = cmap_to_glyph(S_corr);
250 }
251 if (svl.level.flags.hero_memory
252 && (glyph_is_unexplored(lev->glyph) || glyph_is_cmap(lev->glyph)))
253 lev->glyph = glyph;
254 if (show)
255 show_glyph(x, y, glyph);
256
257 update_lastseentyp(x, y);
258}
259
260/*
261 * The routines map_background(), map_object(), and map_trap() could just

Callers 3

furniture_detectFunction · 0.85
show_map_spotFunction · 0.85
findoneFunction · 0.85

Calls 3

back_to_glyphFunction · 0.85
show_glyphFunction · 0.85
update_lastseentypFunction · 0.85

Tested by

no test coverage detected