Forther break apart the magic enconding of travel arrays.
[open-adventure.git] / main.c
diff --git a/main.c b/main.c
index df6f9aa7dfa2ba5054b40cf3c5cd6a483971c575..fc4f9bea8fbcb77524915bea5c8b80e3f07e98dd 100644 (file)
--- a/main.c
+++ b/main.c
@@ -45,7 +45,6 @@ static void sig_handler(int signo)
  * MAIN PROGRAM
  *
  *  Adventure (rev 2: 20 treasures)
-Here's what we think. *
  *  History: Original idea & 5-treasure version (adventures) by Willie Crowther
  *           15-treasure version (adventure) by Don Woods, April-June 1977
  *           20-treasure version (rev 2) by Don Woods, August 1978
@@ -629,7 +628,7 @@ static bool playermove( int motion)
                         BUG(CONDITIONAL_TRAVEL_ENTRY_WITH_NO_ALTERATION); // LCOV_EXCL_LINE
                     ++te_tmp;
                 } while
-                (T_HIGH(travel[travel_entry]) == T_HIGH(travel[te_tmp]));
+                       ((T_DESTINATION(travel[travel_entry]) == T_DESTINATION(travel[te_tmp])) && (T_CONDITION(travel[travel_entry]) == T_CONDITION(travel[te_tmp])));
                 travel_entry = te_tmp;
             }
 
@@ -671,7 +670,7 @@ static bool playermove( int motion)
                             BUG(CONDITIONAL_TRAVEL_ENTRY_WITH_NO_ALTERATION); // LCOV_EXCL_LINE
                         ++te_tmp;
                     } while
-                    (T_HIGH(travel[travel_entry]) == T_HIGH(travel[te_tmp]));
+                       ((T_DESTINATION(travel[travel_entry]) == T_DESTINATION(travel[te_tmp])) && (T_CONDITION(travel[travel_entry]) == T_CONDITION(travel[te_tmp])));
                     travel_entry = te_tmp;
                     continue; /* goto L12 */
                 case 3:
@@ -770,8 +769,8 @@ static bool closecheck(void)
         juggle(CHASM);
         if (game.prop[BEAR] != BEAR_DEAD)
             DESTROY(BEAR);
-        game.prop[CHAIN] = 0;
-        game.fixed[CHAIN] = 0;
+        game.prop[CHAIN] = CHAIN_HEAP;
+        game.fixed[CHAIN] = CHAIN_HEAP;
         game.prop[AXE] = 0;
         game.fixed[AXE] = 0;
         rspeak(CAVE_CLOSING);
@@ -873,8 +872,8 @@ static void listobjects(void)
 /*  Print out descriptions of objects at this location.  If
  *  not closing and property value is negative, tally off
  *  another treasure.  Rug is special case; once seen, its
- *  game.prop is 1 (dragon on it) till dragon is killed.
- *  Similarly for chain; game.prop is initially 1 (locked to
+ *  game.prop is RUG_DRAGON (dragon on it) till dragon is killed.
+ *  Similarly for chain; game.prop is initially CHAINING_BEAR (locked to
  *  bear).  These hacks are because game.prop=0 is needed to
  *  get full score. */
 {
@@ -890,8 +889,10 @@ static void listobjects(void)
                 if (game.closed)
                     continue;
                 game.prop[obj] = 0;
-                if (obj == RUG || obj == CHAIN)
-                    game.prop[obj] = 1;
+                if (obj == RUG)
+                    game.prop[RUG] = RUG_DRAGON;
+                if (obj == CHAIN)
+                    game.prop[CHAIN] = CHAINING_BEAR;
                 --game.tally;
                 /*  Note: There used to be a test here to see whether the
                  *  player had blown it so badly that he could never ever see