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

Function show_map_spot

src/detect.c:1371–1419  ·  view source on GitHub ↗

used by magic mapping, clairvoyance, and wand of probing */

Source from the content-addressed store, hash-verified

1369
1370/* used by magic mapping, clairvoyance, and wand of probing */
1371void
1372show_map_spot(coordxy x, coordxy y, boolean cnf)
1373{
1374 struct rm *lev;
1375 struct trap *t;
1376 struct engr *ep;
1377 int oldglyph;
1378
1379 if (cnf && rn2(7))
1380 return;
1381 lev = &levl[x][y];
1382
1383 lev->seenv = SVALL;
1384
1385 /* Secret corridors are found, but not secret doors. */
1386 if (lev->typ == SCORR) {
1387 lev->typ = CORR;
1388 unblock_point(x, y);
1389 }
1390
1391 /*
1392 * Force the real background, then if it's not furniture and there's
1393 * a known trap there, display the trap, else if there was an object
1394 * shown there, redisplay the object. So during mapping, furniture
1395 * takes precedence over traps, which take precedence over objects,
1396 * opposite to how normal vision behaves.
1397 */
1398 oldglyph = glyph_at(x, y);
1399 if (svl.level.flags.hero_memory) {
1400 magic_map_background(x, y, 0);
1401 newsym(x, y); /* show it, if not blocked */
1402 } else {
1403 magic_map_background(x, y, 1); /* display it */
1404 }
1405 if (!IS_FURNITURE(lev->typ)) {
1406 if ((t = t_at(x, y)) != 0 && t->tseen) {
1407 map_trap(t, 1);
1408 } else if ((ep = engr_at(x, y)) != 0 && !cnf) {
1409 map_engraving(ep, 1);
1410 } else if (glyph_is_trap(oldglyph) || glyph_is_object(oldglyph)) {
1411 show_glyph(x, y, oldglyph);
1412 if (svl.level.flags.hero_memory)
1413 lev->glyph = oldglyph;
1414 }
1415 }
1416 /* possibly update #overview */
1417 if (!cnf && lev->roomno >= ROOMOFFSET)
1418 room_discovered(lev->roomno - ROOMOFFSET);
1419}
1420
1421void
1422do_mapping(void)

Callers 3

do_mappingFunction · 0.85
do_vicinity_mapFunction · 0.85
zap_mapFunction · 0.85

Calls 11

rn2Function · 0.85
unblock_pointFunction · 0.85
glyph_atFunction · 0.85
magic_map_backgroundFunction · 0.85
newsymFunction · 0.85
t_atFunction · 0.85
map_trapFunction · 0.85
engr_atFunction · 0.85
map_engravingFunction · 0.85
show_glyphFunction · 0.85
room_discoveredFunction · 0.85

Tested by

no test coverage detected