* newsym() * * Possibly put a new glyph at the given location. */
| 914 | * Possibly put a new glyph at the given location. |
| 915 | */ |
| 916 | void |
| 917 | newsym(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 */ |
no test coverage detected