X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=saveresume.c;h=af71b5ed5ab3ba7672e11a5ff1d6639b0d7cb378;hb=0ffb2978016618ce2ac500a098de7566d0b37add;hp=05e12b7daefe475590cf3f2148193f1da440ed8d;hpb=ba3248224eb2b6a1e5098c788bd2029444d5140a;p=open-adventure.git diff --git a/saveresume.c b/saveresume.c index 05e12b7..af71b5e 100644 --- a/saveresume.c +++ b/saveresume.c @@ -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; @@ -216,7 +219,8 @@ 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 (valgame.prop[obj] < STATE_NOTFOUND || valgame.prop[obj] > 1) { + /* Magic number -2 allows a STASHED version of state 1 */ + if (valgame.prop[obj] < -2 || valgame.prop[obj] > 1) { switch (obj) { case RUG: case DRAGON: