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

Function mon_overrides_region

src/display.c:667–700  ·  view source on GitHub ↗

used by newsym() to decide whether to show a monster or a visible gas cloud region when both are at the same spot; caller deals with region */

Source from the content-addressed store, hash-verified

665/* used by newsym() to decide whether to show a monster or a visible gas
666 cloud region when both are at the same spot; caller deals with region */
667staticfn boolean
668mon_overrides_region(
669 struct monst *mon, /* might be Null */
670 coordxy mx, coordxy my) /* won't match mon->mx,my if long worm's tail */
671{
672 int r;
673
674 /* this is redundant because newsym() doesn't call us when swallowed */
675 if (u.uswallow && (!mon || mon != u.ustuck))
676 return FALSE;
677
678 if (mon) {
679 /* when not a worm tail, show mon if sensed rather than seen */
680 if (mx == mon->mx && my == mon->my
681 && (sensemon(mon) || mon_warning(mon)))
682 return TRUE;
683
684 /* even if worm tail;
685 check whether the spot is adjacent and 'mon' would be visible
686 there if the gas cloud wasn't interfering with normal vision;
687 _mon_visible() handles mon->mundetected; don't need to check
688 infravision when monster is adjacent */
689 r = (u.xray_range > 1) ? u.xray_range : 1;
690 if (!Blind && _mon_visible(mon)
691 && M_AP_TYPE(mon) != M_AP_FURNITURE
692 && M_AP_TYPE(mon) != M_AP_OBJECT
693 && distu(mx, my) <= r * (r + 1))
694 return TRUE;
695 }
696
697 /* if not overriding region for current mon, propagate "remembered,
698 unseen monster" */
699 return glyph_is_invisible(levl[mx][my].glyph) ? TRUE : FALSE;
700}
701
702#ifdef HANGUPHANDLING
703#define _suppress_map_output() \

Callers 1

newsymFunction · 0.85

Calls 2

sensemonFunction · 0.85
mon_warningFunction · 0.85

Tested by

no test coverage detected