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

Function feel_location

src/display.c:745–909  ·  view source on GitHub ↗

* feel_location() * * Feel the given location. This assumes that the hero is blind and that * the given position is either the hero's or one of the eight squares * adjacent to the hero (except for a boulder push). * If an invisible monster has gone away, that will be discovered. If an * invisible monster has appeared, this will _not_ be discovered since * searching only finds one monster

Source from the content-addressed store, hash-verified

743 * searching only finds one monster per turn so we must check that separately.
744 */
745void
746feel_location(coordxy x, coordxy y)
747{
748 struct rm *lev;
749 struct obj *boulder;
750 struct monst *mon;
751 struct engr *ep;
752
753 /* replicate safeguards used by newsym(); might not be required here */
754 if (_suppress_map_output())
755 return;
756 if (!isok(x, y))
757 return;
758 lev = &levl[x][y];
759 /* If hero's memory of an invisible monster is accurate, we want to keep
760 * him from detecting the same monster over and over again on each turn.
761 * We must return (so we don't erase the monster). (We must also, in the
762 * search function, be sure to skip over previously detected 'I's.)
763 */
764 if (glyph_is_invisible(lev->glyph) && m_at(x, y))
765 return;
766
767 /* The hero can't feel non pool locations while under water
768 except for lava and ice. */
769 if (Underwater && !Is_waterlevel(&u.uz)
770 && !is_pool_or_lava(x, y) && !is_ice(x, y))
771 return;
772
773 /* Set the seen vector as if the hero had seen it.
774 It doesn't matter if the hero is levitating or not. */
775 set_seenv(lev, u.ux, u.uy, x, y);
776
777 if (!can_reach_floor(FALSE)) {
778 /*
779 * Levitation Rules. It is assumed that the hero can feel the state
780 * of the walls around herself and can tell if she is in a corridor,
781 * room, or doorway. Boulders are felt because they are large enough.
782 * Anything else is unknown because the hero can't reach the ground.
783 * This makes things difficult.
784 *
785 * Check (and display) in order:
786 *
787 * + Stone, walls, and closed doors.
788 * + Boulders. [see a boulder before a doorway]
789 * + doors.
790 * + Room/water positions
791 * + Everything else (hallways!)
792 */
793 if (IS_OBSTRUCTED(lev->typ)
794 || (IS_DOOR(lev->typ)
795 && (lev->doormask & (D_LOCKED | D_CLOSED)))) {
796 map_background(x, y, 1);
797 } else if ((boulder = sobj_at(BOULDER, x, y)) != 0) {
798 map_object(boulder, 1);
799 } else if (IS_DOOR(lev->typ)) {
800 map_background(x, y, 1);
801 } else if (IS_ROOM(lev->typ) || IS_POOL(lev->typ)) {
802 boolean do_room_glyph;

Callers 12

dosearch0Function · 0.85
dopushFunction · 0.85
cannot_push_msgFunction · 0.85
moverock_coreFunction · 0.85
test_moveFunction · 0.85
pick_lockFunction · 0.85
docloseFunction · 0.85
feel_newsymFunction · 0.85
newsymFunction · 0.85
kick_dumbFunction · 0.85
kick_ouchFunction · 0.85
kick_doorFunction · 0.85

Calls 14

isokFunction · 0.85
is_pool_or_lavaFunction · 0.85
is_iceFunction · 0.85
set_seenvFunction · 0.85
can_reach_floorFunction · 0.85
map_backgroundFunction · 0.85
sobj_atFunction · 0.85
map_objectFunction · 0.85
show_glyphFunction · 0.85
engr_atFunction · 0.85
engr_can_be_feltFunction · 0.85
sensemonFunction · 0.85

Tested by 1

test_moveFunction · 0.68