more alignment conversion
The overview code could reveal the true alignment of an altar if hero saw a mimic pretending to be an altar on that spot, or reveal junk for the alignment when mimicking at altar on some other spot. Avoid passing macros that might evaluate their arguments more than once to other macros which might also do that. The hidden code expansion can easily get out of hand (although in this case it was modest). Also, get rid of the unused MSA_foo alignment values since two of them had the values swapped. Lastly, make Amask2align() more robust in case a value with the shrine bit set gets passed to it.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.7 dungeon.c $NHDT-Date: 1596498164 2020/08/03 23:42:44 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.133 $ */
|
||||
/* NetHack 3.7 dungeon.c $NHDT-Date: 1604105163 2020/10/31 00:46:03 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.135 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Robert Patrick Rankin, 2012. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -2842,10 +2842,13 @@ recalc_mapseen()
|
||||
mptr->feat.ngrave = count;
|
||||
break;
|
||||
case ALTAR:
|
||||
/* get the altarmask for this location; might be a mimic */
|
||||
atmp = altarmask_at(x, y);
|
||||
/* convert to index: 0..3 */
|
||||
atmp = (Is_astralevel(&u.uz)
|
||||
&& (levl[x][y].seenv & SVALL) != SVALL)
|
||||
? MSA_NONE
|
||||
: Amask2msa(levl[x][y].altarmask);
|
||||
: Amask2msa(atmp);
|
||||
if (!mptr->feat.naltar)
|
||||
mptr->feat.msalign = atmp;
|
||||
else if (mptr->feat.msalign != atmp)
|
||||
@@ -3297,6 +3300,8 @@ boolean printdun;
|
||||
an(shop_string(mptr->feat.shoptype)));
|
||||
}
|
||||
if (mptr->feat.naltar > 0) {
|
||||
unsigned atmp;
|
||||
|
||||
/* Temples + non-temple altars get munged into just "altars" */
|
||||
if (mptr->feat.ntemple != mptr->feat.naltar)
|
||||
ADDNTOBUF("altar", mptr->feat.naltar);
|
||||
@@ -3304,7 +3309,9 @@ boolean printdun;
|
||||
ADDNTOBUF("temple", mptr->feat.ntemple);
|
||||
|
||||
/* only print out altar's god if they are all to your god */
|
||||
if (Amask2align(Msa2amask(mptr->feat.msalign)) == u.ualign.type)
|
||||
atmp = mptr->feat.msalign; /* 0, 1, 2, 3 */
|
||||
atmp = Msa2amask(atmp); /* 0, 1, 2, 4 */
|
||||
if (Amask2align(atmp) == u.ualign.type) /* -127, -1, 0, +1 */
|
||||
Sprintf(eos(buf), " to %s", align_gname(u.ualign.type));
|
||||
}
|
||||
ADDNTOBUF("throne", mptr->feat.nthrone);
|
||||
|
||||
Reference in New Issue
Block a user