Proof of concept for Section 3 report generator.
[open-adventure.git] / main.c
diff --git a/main.c b/main.c
index 6fa2ddcbc7c954f53fd111b5ce4bfbd386208586..733027f70eca8160e3813c60aaa4203c6c85d522 100644 (file)
--- a/main.c
+++ b/main.c
@@ -289,10 +289,12 @@ static bool spotted_by_pirate(int i)
         return true;
     int snarfed = 0;
     bool movechest = false, robplayer = false;
-    for (int treasure = MINTRS; treasure <= MAXTRS; treasure++) {
+    for (int treasure = 1; treasure <= NOBJECTS; treasure++) {
+       if (!object_descriptions[treasure].is_treasure)
+           continue;
         /*  Pirate won't take pyramid from plover room or dark
          *  room (too easy!). */
-        if (treasure == PYRAMID && (game.loc == PLAC[PYRAMID] || game.loc == PLAC[EMERALD])) {
+        if (treasure == PYRAMID && (game.loc == object_descriptions[PYRAMID].plac || game.loc == object_descriptions[EMERALD].plac)) {
             continue;
         }
         if (TOTING(treasure) || HERE(treasure))
@@ -323,8 +325,10 @@ static bool spotted_by_pirate(int i)
     }
     if (robplayer) {
         rspeak(PIRATE_POUNCES);
-        for (int treasure = MINTRS; treasure <= MAXTRS; treasure++) {
-            if (!(treasure == PYRAMID && (game.loc == PLAC[PYRAMID] || game.loc == PLAC[EMERALD]))) {
+       for (int treasure = 1; treasure <= NOBJECTS; treasure++) {
+           if (!object_descriptions[treasure].is_treasure)
+               continue;
+            if (!(treasure == PYRAMID && (game.loc == object_descriptions[PYRAMID].plac || game.loc == object_descriptions[EMERALD].plac))) {
                 if (AT(treasure) && game.fixed[treasure] == 0)
                     CARRY(treasure, game.loc);
                 if (TOTING(treasure))
@@ -691,13 +695,13 @@ static bool playermove(token_t verb, int motion)
                         game.prop[TROLL] = 0;
                         MOVE(TROLL2, 0);
                         MOVE(TROLL2 + NOBJECTS, 0);
-                        MOVE(TROLL, PLAC[TROLL]);
-                        MOVE(TROLL + NOBJECTS, FIXD[TROLL]);
+                        MOVE(TROLL, object_descriptions[TROLL].plac);
+                        MOVE(TROLL + NOBJECTS, object_descriptions[TROLL].fixd);
                         JUGGLE(CHASM);
                         game.newloc = game.loc;
                         return true;
                     } else {
-                        game.newloc = PLAC[TROLL] + FIXD[TROLL] - game.loc;
+                        game.newloc = object_descriptions[TROLL].plac + object_descriptions[TROLL].fixd - game.loc;
                         if (game.prop[TROLL] == 0)game.prop[TROLL] = 1;
                         if (!TOTING(BEAR)) return true;
                         rspeak(BRIDGE_COLLAPSE);
@@ -769,8 +773,8 @@ static bool closecheck(void)
         }
         MOVE(TROLL, 0);
         MOVE(TROLL + NOBJECTS, 0);
-        MOVE(TROLL2, PLAC[TROLL]);
-        MOVE(TROLL2 + NOBJECTS, FIXD[TROLL]);
+        MOVE(TROLL2, object_descriptions[TROLL].plac);
+        MOVE(TROLL2 + NOBJECTS, object_descriptions[TROLL].fixd);
         JUGGLE(CHASM);
         if (game.prop[BEAR] != 3)DESTROY(BEAR);
         game.prop[CHAIN] = 0;