fix GitHub issue 1303 related to engravings

GitHub issue reported by ars3niy:
https://github.com/NetHack/NetHack/issues/1303

@ars3niy commented on Oct 27:
Stepping on a square with a dust or "graffiti" engraving while blind
produces no message because presumably you can't read them by swiping
the floor with your hands, however the engraving glyph still shows up on
the map afterwards. While this helps zen players, it looks like a bug.

@ville-v commented 3 days ago:
Searching while blind also reveals the engravings. Here is a save file
demonstrating the issue.
[...]

This adds an erevealed bit to engravings, to accompany the the eread
bit that is already there.

eread:      refers to the text of the engraving
erevealed:  refers to the engraving map symbol

Hopefully, this resolves issue 1303 without creating additional bugs.

This invalidates existing save files and bones.

Fixes #1303
This commit is contained in:
nhmall
2024-12-19 17:53:43 -05:00
parent 1e431139b4
commit f7853be3dc
4 changed files with 74 additions and 27 deletions

View File

@@ -420,10 +420,12 @@ unmap_object(coordxy x, coordxy y)
struct rm *lev = &levl[x][y];
if (spot_shows_engravings(x, y)
&& (ep = engr_at(x, y)) != 0 && !covers_traps(x, y))
&& (ep = engr_at(x, y)) != 0 && !covers_traps(x, y)) {
ep->erevealed = 0;
map_engraving(ep, 0);
else
} else {
map_background(x, y, 0);
}
/* turn remembered dark room squares dark */
if (!lev->waslit && lev->glyph == cmap_to_glyph(S_room)
@@ -443,26 +445,29 @@ unmap_object(coordxy x, coordxy y)
* Internal to display.c, this is a #define for speed.
*/
#define _map_location(x, y, show) \
do { \
struct obj *obj; \
struct trap *trap; \
struct engr *ep; \
NhRegion *_ml_reg; \
\
if ((obj = vobj_at(x, y)) && !covers_objects(x, y)) \
map_object(obj, show); \
else if ((trap = t_at(x, y)) && trap->tseen && !covers_traps(x, y)) \
map_trap(trap, show); \
else if (spot_shows_engravings(x, y) \
&& (ep = engr_at(x, y)) != 0 \
&& !covers_traps(x, y)) \
map_engraving(ep, show); \
else \
map_background(x, y, show); \
\
update_lastseentyp(x, y); \
if (show && !Blind && (_ml_reg = visible_region_at(x, y)) != 0) \
show_region(_ml_reg, x, y); \
do { \
struct obj *obj; \
struct trap *trap; \
struct engr *ml_ep; \
NhRegion *_ml_reg; \
\
if ((obj = vobj_at(x, y)) && !covers_objects(x, y)) { \
map_object(obj, show); \
} else if ((trap = t_at(x, y)) \
&& trap->tseen && !covers_traps(x, y)) { \
map_trap(trap, show); \
} else if (spot_shows_engravings(x, y) \
&& (ml_ep = engr_at(x, y)) != 0 \
&& ml_ep->erevealed != 0 \
&& !covers_traps(x, y)) { \
map_engraving(ml_ep, show); \
} else { \
map_background(x, y, show); \
} \
\
update_lastseentyp(x, y); \
if (show && !Blind && (_ml_reg = visible_region_at(x, y)) != 0) \
show_region(_ml_reg, x, y); \
} while (0)
void
@@ -742,6 +747,7 @@ feel_location(coordxy x, coordxy y)
struct rm *lev;
struct obj *boulder;
struct monst *mon;
struct engr *ep;
/* replicate safeguards used by newsym(); might not be required here */
if (_suppress_map_output())
@@ -851,6 +857,9 @@ feel_location(coordxy x, coordxy y)
show_glyph(x, y, lev->glyph = cmap_to_glyph(S_darkroom));
}
} else {
if ((ep = engr_at(x, y)) && !ep->erevealed && engr_can_be_felt(ep))
ep->erevealed = 1;
_map_location(x, y, 1);
if (Punished) {
@@ -911,6 +920,7 @@ newsym(coordxy x, coordxy y)
int see_it;
boolean worm_tail;
struct rm *lev = &(levl[x][y]);
struct engr *ep;
/* don't try to produce map output when level is in a state of flux */
if (_suppress_map_output())
@@ -1009,8 +1019,11 @@ newsym(coordxy x, coordxy y)
display_warning(mon);
} else if (glyph_is_invisible(lev->glyph)) {
map_invisible(x, y);
} else
} else {
if ((ep = engr_at(x, y)) && !ep->erevealed)
ep->erevealed = 1;
_map_location(x, y, 1); /* map the location */
}
}
/* Can't see the location. */