]> granicus.if.org Git - nethack/commitdiff
warning and a bit of alignment-related header consolidation
authornhmall <nhmall@nethack.org>
Fri, 30 Oct 2020 13:08:23 +0000 (09:08 -0400)
committernhmall <nhmall@nethack.org>
Fri, 30 Oct 2020 13:08:23 +0000 (09:08 -0400)
include/align.h
include/dungeon.h
include/rm.h
src/dungeon.c

index 9e3e658ff742008136ddb497ec6a802104d704e8..45b10d768b82c1ca964508db426ea35da7233f4b 100644 (file)
@@ -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 */
index 83ea0015c39db48987da23b336b42162133d5828..2a135c62f69b087c079ca00409bcb00ac811b1b9 100644 (file)
@@ -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 {
index 761e8b30cbb1c9a712e31f0f6d9a89c14c76ef2c..fbaa8a388496d9f290e78afcaf311a683bb72cbe 100644 (file)
@@ -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.
  */
index 935a32088f2373f8d114e4b9090efd7345fcd5ae..17a5ba3f12ad4bc53c999ccb2068c47ec7ca8489 100644 (file)
@@ -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