More macro abstraction of the travel opcodes.
[open-adventure.git] / newdungeon.py
index b4c85b28d4f59561fbd4d9935bbb63f189fc06fa..27dd9f181afa1cbe74fdca5afb3ea427fab03287 100755 (executable)
@@ -142,6 +142,20 @@ 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_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).stop)
+#define T_HIGH(entry)          ((entry).opcode / 1000)
+#define T_LOW(entry)           ((entry).opcode % 1000)
+#define L_SPEAK(loc)           ((loc) - 500)
+
 extern const location_t locations[];
 extern const object_t objects[];
 extern const char* arbitrary_messages[];