Add message and bailout on invalid save.
[open-adventure.git] / saveresume.c
index d66854344733de47951fb7a3cd33f9eba356f72c..c9278a413bf448ba6ec096a1fcbc711ac887f1c2 100644 (file)
@@ -137,7 +137,10 @@ int restore(FILE* fp)
     fclose(fp);
     if (save.version != VRSION) {
         rspeak(VERSION_SKEW, save.version / 10, MOD(save.version, 10), VRSION / 10, MOD(VRSION, 10));
-    } else if (is_valid(save.game)) {
+    } else if (!is_valid(save.game)) {
+       rspeak(SAVE_TAMPERING);
+       exit(EXIT_SUCCESS);
+    } else {
         game = save.game;
     }
     return GO_TOP;
@@ -230,7 +233,7 @@ bool is_valid(struct game_t valgame)
             case VASE:
             case CHAIN:
                 if (valgame.prop[obj] == 2) // There are multiple different states, but it's convenient to clump them together
-                    continue;
+                    continue;  // LCOV_EXCL_LINE
             /* FALLTHRU */
             case BEAR:
                 if (valgame.prop[BEAR] == CONTENTED_BEAR || valgame.prop[BEAR] == BEAR_DEAD)