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

Function newsym

src/display.c:916–1099  ·  view source on GitHub ↗

* newsym() * * Possibly put a new glyph at the given location. */

Source from the content-addressed store, hash-verified

914 * Possibly put a new glyph at the given location.
915 */
916void
917newsym(coordxy x, coordxy y)
918{
919 struct rm *lev;
920 struct engr *ep;
921 struct monst *mon;
922 int see_it;
923 boolean worm_tail;
924
925 /* don't try to produce map output when level is in a state of flux */
926 if (_suppress_map_output())
927 return;
928 /* should never happen; same error handling as u_on_newpos() */
929 if (!isok(x, y)) {
930 void (*errfunc)(const char *, ...) PRINTF_F_PTR(1, 2);
931
932 errfunc = (x < 0 || y < 0 || x > COLNO - 1 || y > ROWNO - 1) ? panic
933 : impossible; /* misuse of column 0 is less severe */
934 (*errfunc)("newsym: attempting screen update for <%d,%d>", x, y);
935 return;
936 }
937
938 /* only permit updating the hero when swallowed */
939 if (u.uswallow) {
940 if (u_at(x, y))
941 display_self();
942 return;
943 }
944 if (Underwater && !Is_waterlevel(&u.uz)) {
945 /* when underwater, don't do anything unless <x,y> is an
946 adjacent water or lava or ice position */
947 if (!(is_pool_or_lava(x, y) || is_ice(x, y)) || !next2u(x, y))
948 return;
949 }
950 lev = &levl[x][y];
951
952 /* Can physically see the location. */
953 if (cansee(x, y)) {
954 NhRegion *reg = visible_region_at(x, y);
955 /*
956 * Don't use templit here: E.g.
957 *
958 * lev->waslit = !!(lev->lit || templit(x,y));
959 *
960 * Otherwise we have the "light pool" problem, where non-permanently
961 * lit areas just out of sight stay remembered as lit. They should
962 * re-darken.
963 *
964 * Perhaps ALL areas should revert to their "unlit" look when
965 * out of sight.
966 */
967 lev->waslit = (lev->lit != 0); /* remember lit condition */
968
969 mon = m_at(x, y);
970 worm_tail = is_worm_tail(mon);
971
972 if ((ep = engr_at(x, y)) != 0)
973 ep->erevealed = 1; /* even when covered by objects or a monster */

Callers 15

redraw_map_regionFunction · 0.85
savebonesFunction · 0.85
throne_sit_effectFunction · 0.85
attrcurseFunction · 0.85
toss_wsegsFunction · 0.85
worm_moveFunction · 0.85
see_wsegsFunction · 0.85
remove_wormFunction · 0.85
place_worm_tail_randomlyFunction · 0.85
redraw_wormFunction · 0.85
stealgoldFunction · 0.85
relobjFunction · 0.85

Calls 15

isokFunction · 0.85
is_pool_or_lavaFunction · 0.85
is_iceFunction · 0.85
visible_region_atFunction · 0.85
engr_atFunction · 0.85
mon_overrides_regionFunction · 0.85
show_regionFunction · 0.85
mon_visibleFunction · 0.85
tp_sensemonFunction · 0.85
t_atFunction · 0.85
display_monsterFunction · 0.85
mon_warningFunction · 0.85

Tested by

no test coverage detected