X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=saveresume.c;h=70b946195a5266a6b067d674d170b8c361808cf6;hb=7d4dd78679453010fc71aa51a51fbf4e13b018a8;hp=4cac0343a2a41f7c7a59a573ba61caa44414cf30;hpb=eebc87f889b0fa1404684aa6e72dda5a5e53d96b;p=open-adventure.git diff --git a/saveresume.c b/saveresume.c index 4cac034..70b9461 100644 --- a/saveresume.c +++ b/saveresume.c @@ -218,7 +218,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; } } @@ -229,30 +229,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++) { - /* Magic number -2 allows a STASHED version of state 1 */ - if (valgame.objects[obj].prop < -2 || valgame.objects[obj].prop > 1) { - 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 - } + if (PROP_IS_INVALID(valgame.objects[obj].prop)) { + return false; // LCOV_EXCL_LINE } }