After splitting out the stop field, nothing ever negates a travel opcode...
[open-adventure.git] / main.c
diff --git a/main.c b/main.c
index 5ad7d90ffe203396e7844b8a0a599b5d0c4ee491..579ecfcecc294160c7dcfcb99a517eba1a886782 100644 (file)
--- a/main.c
+++ b/main.c
  * inherited from FORTRAN, someday. To understand these, read the
  * encoding description for travel.
  */
-#define T_DESTINATION(entry)   MOD(labs(entry) / 1000, 1000)
-#define T_NODWARVES(entry)     labs(entry) / 1000000 == 100
-#define T_MOTION(entry)                MOD(labs(entry), 1000)
-#define L_SPEAK(loc)           ((loc) - 500)
+#define T_DESTINATION(entry)   MOD((entry).opcode / 1000, 1000)
+#define T_NODWARVES(entry)     ((entry).opcode / 1000000 == 100)
+#define T_MOTION(entry)                MOD((entry).opcode, 1000)
 #define T_TERMINATE(entry)     (T_MOTION(entry) == 1)
-#define T_STOP(entry)          ((entry) < 0)
-#define T_OPCODE(entry)                (entry)
+#define T_STOP(entry)          ((entry).stop)
+#define T_OPCODE(entry)                ((entry).opcode)
+#define L_SPEAK(loc)           ((loc) - 500)
 
 struct game_t game;
 
@@ -619,7 +619,7 @@ static bool playermove(token_t verb, int motion)
         }
         ++kk;
     }
-    scratchloc = labs(T_OPCODE(travel[kk])) / 1000;
+    scratchloc = T_OPCODE(travel[kk]) / 1000;
 
     do {
         /*
@@ -648,7 +648,7 @@ static bool playermove(token_t verb, int motion)
                     if (T_STOP(travel[kk]))
                         BUG(CONDITIONAL_TRAVEL_ENTRY_WITH_NO_ALTERATION);
                     ++kk;
-                    game.newloc = labs(T_OPCODE(travel[kk])) / 1000;
+                    game.newloc = T_OPCODE(travel[kk]) / 1000;
                 } while
                 (game.newloc == scratchloc);
                 scratchloc = game.newloc;
@@ -689,7 +689,7 @@ static bool playermove(token_t verb, int motion)
                         if (T_STOP(travel[kk]))
                             BUG(CONDITIONAL_TRAVEL_ENTRY_WITH_NO_ALTERATION);
                         ++kk;
-                        game.newloc = labs(T_OPCODE(travel[kk])) / 1000;
+                        game.newloc = T_OPCODE(travel[kk]) / 1000;
                     } while
                     (game.newloc == scratchloc);
                     scratchloc = game.newloc;