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

Function furniture_detect

src/detect.c:1090–1134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1088}
1089
1090staticfn int
1091furniture_detect(void)
1092{
1093 struct monst *mon;
1094 coordxy x, y;
1095 int glyph, sym, found = 0, revealed = 0;
1096
1097 (void) unconstrain_map();
1098
1099 for (y = 0; y < ROWNO; ++y)
1100 for (x = 1; x < COLNO; ++x) {
1101 glyph = glyph_at(x, y);
1102 sym = glyph_to_cmap(glyph);
1103 if (IS_FURNITURE(levl[x][y].typ)) {
1104 ++found;
1105 magic_map_background(x, y, 1);
1106 } else if (is_cmap_furniture(sym)) {
1107 ++found;
1108 if ((mon = m_at(x, y)) != 0
1109 && M_AP_TYPE(mon) == M_AP_FURNITURE)
1110 seemimic(mon);
1111 if (!mon || !canspotmon(mon))
1112 map_invisible(x, y);
1113 }
1114 if (glyph_at(x, y) != glyph)
1115 ++revealed;
1116 }
1117
1118 if (!found)
1119 There("seems to be nothing of interest on this level.");
1120 else if (!revealed)
1121 /* [what about clipped map with points of interest outside of the
1122 currently shown area?] */
1123 Your("map already shows all relevant locations.");
1124
1125 if (!revealed)
1126 display_nhwindow(WIN_MAP, TRUE);
1127 else /* we need to browse all types because we haven't redrawn the map
1128 * with only points of interest */
1129 browse_map(TER_DETECT | TER_MAP | TER_TRP | TER_OBJ | TER_MON,
1130 "location");
1131
1132 map_redisplay();
1133 return 0;
1134}
1135
1136/* way back in 3.0plN and/or 2.x, you could use a crystal ball to find out
1137 where the wizard was relative to your current location; that was when the

Callers 1

use_crystal_ballFunction · 0.85

Calls 10

unconstrain_mapFunction · 0.85
glyph_atFunction · 0.85
glyph_to_cmapFunction · 0.85
magic_map_backgroundFunction · 0.85
seemimicFunction · 0.85
map_invisibleFunction · 0.85
ThereFunction · 0.85
YourFunction · 0.85
browse_mapFunction · 0.85
map_redisplayFunction · 0.85

Tested by

no test coverage detected