Reduce include complexity.
[open-adventure.git] / saveresume.c
index ceda43c1671edb1dadffaedd81d9d0df99d74c9e..3b94b4845a2a568a373ec5661a015f07d85a6c36 100644 (file)
@@ -16,7 +16,6 @@
 #include <inttypes.h>
 
 #include "advent.h"
-#include "dungeon.h"
 
 /*
  * Use this to detect endianness mismatch.  Can't be unchanged by byte-swapping.
@@ -137,7 +136,7 @@ int restore(FILE* fp)
      *  sane initial state.
      *  If ADVENT_NOSAVE is defined, gripe instead. */
 #ifdef ADVENT_NOSAVE
-    rspeak(SAVERESUME_DISABLED)
+    rspeak(SAVERESUME_DISABLED);
     return GO_TOP;
 #endif
 
@@ -218,7 +217,7 @@ bool is_valid(struct game_t valgame)
     int temp_tally = 0;
     for (int treasure = 1; treasure <= NOBJECTS; treasure++) {
         if (objects[treasure].is_treasure) {
-            if (valgame.objects[treasure].prop == STATE_NOTFOUND) {
+            if (PROP_IS_NOTFOUND2(valgame, treasure)) {
                 ++temp_tally;
             }
         }
@@ -230,28 +229,7 @@ bool is_valid(struct game_t valgame)
     /* Check that properties of objects aren't beyond expected */
     for (obj_t obj = 0; obj <= NOBJECTS; obj++) {
         if (PROP_IS_INVALID(valgame.objects[obj].prop)) {
-            switch (obj) {
-            case RUG:
-            case DRAGON:
-            case BIRD:
-            case BOTTLE:
-            case PLANT:
-            case PLANT2:
-            case TROLL:
-            case URN:
-            case EGGS:
-            case VASE:
-            case CHAIN:
-                if (valgame.objects[obj].prop == 2) // There are multiple different states, but it's convenient to clump them together
-                    continue;  // LCOV_EXCL_LINE
-            /* FALLTHRU */
-            case BEAR:
-                if (valgame.objects[BEAR].prop == CONTENTED_BEAR || valgame.objects[BEAR].prop == BEAR_DEAD)
-                    continue;
-            /* FALLTHRU */
-            default:
-                return false;  // LCOV_EXCL_LINE
-            }
+           return false;       // LCOV_EXCL_LINE
         }
     }