Magic-number elimination.
authorEric S. Raymond <esr@thyrsus.com>
Tue, 19 Apr 2022 21:07:46 +0000 (17:07 -0400)
committerEric S. Raymond <esr@thyrsus.com>
Tue, 19 Apr 2022 21:07:46 +0000 (17:07 -0400)
init.c
main.c
templates/dungeon.h.tpl

diff --git a/init.c b/init.c
index a897936813ae9cab66db2ec3e2223bda52002a98..9333df3be8e90d6a7549447cd565e6da20e4f57d 100644 (file)
--- a/init.c
+++ b/init.c
@@ -60,7 +60,7 @@ int initialise(void)
         if (!(locations[i].description.big == 0 ||
               tkey[i] == 0)) {
             int k = tkey[i];
-            if (T_TERMINATE(travel[k]))
+            if (travel[k].motion == HERE)
                 conditions[i] |= (1 << COND_FORCED);
         }
     }
diff --git a/main.c b/main.c
index 809574b6c35cc82e02208a05862133463aa26e2b..b3a8f95fd0fc02a75ce31844423f2df4493c273e 100644 (file)
--- a/main.c
+++ b/main.c
@@ -656,7 +656,7 @@ static void playermove(int motion)
     /* Look for a way to fulfil the motion verb passed in - travel_entry indexes
      * the beginning of the motion entries for here (game.loc). */
     for (;;) {
-        if (T_TERMINATE(travel[travel_entry]) ||
+        if ((travel[travel_entry].motion == HERE) ||
             travel[travel_entry].motion == motion)
             break;
         if (travel[travel_entry].stop) {
index 8c07ed523f9315063591dcdedd66e7b1d4dcd520..66d65ab41aedab0ca77338fc579b201fe1e08857 100644 (file)
@@ -104,13 +104,6 @@ typedef struct {{
   const bool stop;
 }} travelop_t;
 
-/* Abstract out the encoding of words in the travel array.  Gives us
- * some hope of getting to a less cryptic representation than we
- * inherited from FORTRAN, someday. To understand these, read the
- * encoding description for travel.
- */
-#define T_TERMINATE(entry)     ((entry).motion == 1)
-
 extern const location_t locations[];
 extern const object_t objects[];
 extern const char* arbitrary_messages[];