alignment of mimicked or polymorphed altars

A reddit thread about an unaligned altar in an aligned temple was
a tipoff that mimics posing as altars didn't have any particular
alignment.  The look-at code was misusing an operloaded field of the
underlying terrain.  Pick an alignment at random when taking on the
appearance of an altar, store it in the mimic's mon->mextra->mcorpsenm
field, and have look-at use that.

Also, dropping a ring of polymorph into a sink can transform it, and
one possible outcome is an altar.  In this case, the alignment is
part of the location's topology, but code setting that up was using
Align2amask(rn2(foo)).  That's a macro which evaluates its argument
more than once.  The first evaluation was effectively a no-op.  If
the second evaluation picked lawful then the result was lawful as
intended.  But if the second picked non-lawful and the third picked
lawful, the result would end up as none-of-the-above (a value of 3
when it needs to be a single-bit mask of 1, 2, or 4).
This commit is contained in:
PatR
2019-11-25 15:01:40 -08:00
parent 2288b94ae4
commit 3130676077
5 changed files with 42 additions and 18 deletions

View File

@@ -1,4 +1,4 @@
$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.190 $ $NHDT-Date: 1574638389 2019/11/24 23:33:09 $
$NHDT-Branch: NetHack-3.6 $:$NHDT-Revision: 1.191 $ $NHDT-Date: 1574722861 2019/11/25 23:01:01 $
This fixes36.3 file is here to capture information about updates in the 3.6.x
lineage following the release of 3.6.2 in May 2019. Please note, however,
@@ -302,7 +302,11 @@ when Riders use their bargethrough capability, don't let them swap places with
there'd be no corpse so no auto-revive)
putting on levitation boots while on sink would crash when attempting to set
the enchantment known flag on Null 'uarmf' pointer
unix: Fix double DLB definition in linux hints file
look-at of mimics mimicking altars got an arbitary alignment from misuse of
underlying terrain
polymorph_sink creating an altar passed a call to rn2() as an argument to a
macro which evaluates its parameter more than once
unix: fix double DLB definition in linux hints file
windows: fix --showpaths output for the data file which relies on being
constructed programmatically to incorporate the version suffix