fix github issue #1289 - odd "unexplored area"
Issue reported by ars3niy: an arrow trap covered by more than one stack of arrows was described by farlook as "unexplored area". Later simplified to any object pile with plain arrows on top; the trap turned out to be irrelevant aside from producing a pile of arrow stacks. This problem turns out to be due to an off by 1 error introduced into the xxx_is_piletop() macros when generic objects were added in mid-January of last year, and plain arrow is the first real object so suffered from the bug. Misclassifying the glyph at a specific location also confused the #terrain command but it's the same bug. Knowing what was wrong (map glyph was UNEXPLORED when it should have been ARROW) wasn't sufficient to figure out the problem. Without the simplified way of reproducing the problem, I would never have managed to use 'git bisect' to find the offending commit because that would have been too time consuming. Fixes #1289
This commit is contained in:
@@ -837,20 +837,20 @@ enum glyph_offsets {
|
||||
/* generic objects are after strange object (GLYPH_OBJ_OFF) and before
|
||||
other objects (GLYPH_OBJ_OFF + FIRST_OBJECT) */
|
||||
#define glyph_is_normal_generic_obj(glyph) \
|
||||
((glyph) > GLYPH_OBJ_OFF && (glyph) < GLYPH_OBJ_OFF + FIRST_OBJECT)
|
||||
((glyph) > GLYPH_OBJ_OFF && (glyph) < GLYPH_OBJ_OFF + FIRST_OBJECT - 1)
|
||||
#define glyph_is_piletop_generic_obj(glyph) \
|
||||
((glyph) > GLYPH_OBJ_PILETOP_OFF \
|
||||
&& (glyph) < GLYPH_OBJ_PILETOP_OFF + FIRST_OBJECT)
|
||||
&& (glyph) < GLYPH_OBJ_PILETOP_OFF + FIRST_OBJECT - 1)
|
||||
#define glyph_is_generic_object(glyph) \
|
||||
(glyph_is_normal_generic_obj(glyph) \
|
||||
|| glyph_is_piletop_generic_obj(glyph))
|
||||
#define glyph_is_normal_piletop_obj(glyph) \
|
||||
((glyph) == GLYPH_OBJ_PILETOP_OFF \
|
||||
|| ((glyph) > GLYPH_OBJ_PILETOP_OFF + FIRST_OBJECT \
|
||||
|| ((glyph) > GLYPH_OBJ_PILETOP_OFF + FIRST_OBJECT - 1 \
|
||||
&& (glyph) < (GLYPH_OBJ_PILETOP_OFF + NUM_OBJECTS)))
|
||||
#define glyph_is_normal_object(glyph) \
|
||||
((glyph) == GLYPH_OBJ_OFF \
|
||||
|| ((glyph) >= GLYPH_OBJ_OFF + FIRST_OBJECT \
|
||||
|| ((glyph) >= GLYPH_OBJ_OFF + FIRST_OBJECT - 1 \
|
||||
&& (glyph) < (GLYPH_OBJ_OFF + NUM_OBJECTS)) \
|
||||
|| glyph_is_normal_piletop_obj(glyph))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user