From: nhmall Date: Fri, 30 Oct 2020 13:08:23 +0000 (-0400) Subject: warning and a bit of alignment-related header consolidation X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=01c4a50f98cd9505024df635334e105fde9a624d;p=nethack warning and a bit of alignment-related header consolidation --- diff --git a/include/align.h b/include/align.h index 9e3e658ff..45b10d768 100644 --- a/include/align.h +++ b/include/align.h @@ -30,6 +30,8 @@ typedef struct align { /* alignment & record */ #define AM_LAWFUL 4 #define AM_MASK 7 +/* Some altars are considered as shrines, so we need a flag. */ +#define AM_SHRINE 8 #define AM_SPLEV_CO 3 #define AM_SPLEV_NONCO 7 @@ -41,4 +43,14 @@ typedef struct align { /* alignment & record */ #define Align2amask(x) \ (((x) == A_NONE) ? AM_NONE : ((x) == A_LAWFUL) ? AM_LAWFUL : (x) + 2) +/* Because clearly Nethack needs more ways to specify alignment. + The Amask2msa AM_LAWFUL check needs to mask with AM_MASK to + strip off possible AM_SHRINE bit */ +#define Amask2msa(x) (((x) & AM_MASK) == AM_LAWFUL ? 3 : (x) & AM_MASK) +#define Msa2amask(x) ((x) == 3 ? AM_LAWFUL : (x)) +#define MSA_NONE 0 /* unaligned or multiple alignments */ +#define MSA_LAWFUL 1 +#define MSA_NEUTRAL 2 +#define MSA_CHAOTIC 3 + #endif /* ALIGN_H */ diff --git a/include/dungeon.h b/include/dungeon.h index 83ea0015c..2a135c62f 100644 --- a/include/dungeon.h +++ b/include/dungeon.h @@ -182,14 +182,6 @@ struct linfo { * fountains"). This makes it also subject to player conditions (amnesia). */ -/* Because clearly Nethack needs more ways to specify alignment */ -#define Amask2msa(x) ((x) == 4 ? 3 : (x) &AM_MASK) -#define Msa2amask(x) ((x) == 3 ? 4 : (x)) -#define MSA_NONE 0 /* unaligned or multiple alignments */ -#define MSA_LAWFUL 1 -#define MSA_NEUTRAL 2 -#define MSA_CHAOTIC 3 - /* what the player knows about a single dungeon level */ /* initialized in mklev() */ typedef struct mapseen { diff --git a/include/rm.h b/include/rm.h index 761e8b30c..fbaa8a388 100644 --- a/include/rm.h +++ b/include/rm.h @@ -335,11 +335,6 @@ extern const struct symdef def_warnsyms[WARNCOUNT]; #define D_TRAPPED 16 #define D_SECRET 32 /* only used by sp_lev.c, NOT in rm-struct */ -/* - * Some altars are considered as shrines, so we need a flag. - */ -#define AM_SHRINE 8 - /* * Thrones should only be looted once. */ diff --git a/src/dungeon.c b/src/dungeon.c index 935a32088..17a5ba3f1 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -2672,8 +2672,8 @@ recalc_mapseen() struct monst *mtmp; struct cemetery *bp, **bonesaddr; struct trap *t; - unsigned i, ridx; - int x, y, ltyp, count, atmp; + unsigned i, ridx, atmp; + int x, y, ltyp, count; /* Should not happen in general, but possible if in the process * of being booted from the quest. The mapseen object gets