Give the FORCED property a real cond bit. Delete some unused code.
[open-adventure.git] / init.c
diff --git a/init.c b/init.c
index 0e52a32c5ce3d66b35f0cf3743d0675c07e32d3a..1ed9df6c4561f3700f3abc2ad2c5e68b0ec4310d 100644 (file)
--- a/init.c
+++ b/init.c
@@ -5,7 +5,6 @@
 
 #include "advent.h"
 #include "database.h"
-#include "newdb.h"
 
 /*
  * Initialisation
@@ -185,7 +184,8 @@ void initialise(void)
         game.abbrev[i] = 0;
         if (!(locations[i].description.big == 0 || KEY[i] == 0)) {
             int k = KEY[i];
-            if (MOD(labs(TRAVEL[k]), 1000) == 1)COND[i] = 2;
+            if (MOD(labs(TRAVEL[k]), 1000) == 1)
+               conditions[i] |= (1 << COND_FORCED);
         }
         game.atloc[i] = 0;
     }
@@ -226,7 +226,7 @@ void initialise(void)
     /*  Clear the hint stuff.  game.hintlc[i] is how long he's been at LOC
      *  with cond bit i.  game.hinted[i] is true iff hint i has been
      *  used. */
-    for (int i = 1; i <= HNTMAX; i++) {
+    for (int i = 0; i < HINT_COUNT; i++) {
         game.hinted[i] = false;
         game.hintlc[i] = 0;
     }
@@ -352,16 +352,10 @@ void initialise(void)
      * game.limit      Lifetime of lamp (not set here)
      * maximum_deaths          Number of reincarnation messages available (up to 5)
      * game.numdie     Number of times killed so far
-     * game.thresh     Next #turns threshhold (-1 if none)
-     * game.trndex     Index in TRNVAL of next threshold (db section 14)
      * game.trnluz     # points lost so far due to number of turns used
      * game.turns      Tallies how many commands he's given (ignores yes/no)
      * Logicals were explained earlier */
     game.turns = 0;
-    game.trndex = 1;
-    game.thresh = -1;
-    if (TRNVLS > 0)
-        game.thresh = MOD(TRNVAL[1], 100000) + 1;
     game.trnluz = 0;
     game.lmwarn = false;
     game.iwest = 0;
@@ -383,4 +377,17 @@ void initialise(void)
     game.clshnt = false;
     game.novice = false;
     game.blklin = true;
+
+#ifdef ODEBUG
+# define NEWFLAGS      ((1<<COND_ABOVE)|(1<<COND_FOREST)|(1<<COND_DEEP));
+    int mismatches = 0;
+    for (int i = 0; i < LOCSIZ; i++) {
+       long condbits = conditions[i] & ~NEWFLAGS;
+       if (condbits == COND[i] || COND[i] == 2 && condbits == 0)
+           continue;
+       ++mismatches;
+       printf("Mismatch at %ld: COND=%x consitions=%x\n", COND[i], condbits);
+    }
+    printf("%d condbit mismatches\n", mismatches);
+#endif
 }