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

Function map_object

src/display.c:332–366  ·  view source on GitHub ↗

* map_object() * * Map the given object. This routine assumes that the hero can physically * see the location of the object. Update the screen if directed. * [Note: feel_location() -> map_location() -> map_object() contradicts * the claim here that the hero can see obj's .] */

Source from the content-addressed store, hash-verified

330 * the claim here that the hero can see obj's <ox,oy>.]
331 */
332void
333map_object(struct obj *obj, int show)
334{
335 coordxy x = obj->ox, y = obj->oy;
336 int glyph = obj_to_glyph(obj, newsym_rn2);
337
338 /* if this object is already displayed as a generic object, it might
339 become a specific one now */
340 if (glyph_is_generic_object(glyph) && cansee(x, y) && !Hallucination) {
341 /* these 'r' and 'neardist' calculations match distant_name(objnam.c)
342 and see_nearby_objects(below); we assume that this is a lone
343 object or a pile-top, not something below the top of a pile */
344 int r = (u.xray_range > 2) ? u.xray_range : 2,
345 /* neardist produces a small square with rounded corners */
346 neardist = (r * r) * 2 - r; /* same as r*r + r*(r-1) */
347
348 if (distu(x, y) <= neardist) {
349 observe_object(obj);
350 glyph = obj_to_glyph(obj, newsym_rn2);
351 }
352 }
353
354 if (svl.level.flags.hero_memory) {
355 /* MRKR: While hallucinating, statues are seen as random monsters */
356 /* but remembered as random objects. */
357
358 if (Hallucination && obj->otyp == STATUE) {
359 levl[x][y].glyph = random_obj_to_glyph(newsym_rn2);
360 } else {
361 levl[x][y].glyph = glyph;
362 }
363 }
364 if (show)
365 show_glyph(x, y, glyph);
366}
367
368/*
369 * map_invisible()

Callers 14

gold_detectFunction · 0.85
food_detectFunction · 0.85
object_detectFunction · 0.85
sense_trapFunction · 0.85
do_vicinity_mapFunction · 0.85
premap_detectFunction · 0.85
move_bcFunction · 0.85
dropzFunction · 0.85
moverock_coreFunction · 0.85
domove_fight_emptyFunction · 0.85
show_mon_or_warnFunction · 0.85
display_monsterFunction · 0.85

Calls 2

observe_objectFunction · 0.85
show_glyphFunction · 0.85

Tested by

no test coverage detected