Add message and bailout on invalid save.

Note: save/resume still fails at saveresume.4
at this revision.
This commit is contained in:
Eric S. Raymond 2023-03-12 06:39:57 -04:00
parent 569a39aa7c
commit 04df0ce64c
3 changed files with 17 additions and 20 deletions

View file

@ -3189,13 +3189,13 @@ arbitrary_messages: !!omap
save file format, and this program uses Version %d.%d. You must find an instance save file format, and this program uses Version %d.%d. You must find an instance
using that other version in order to resume that Adventure. using that other version in order to resume that Adventure.
# This message is not currently used # This message is not currently used
#- SAVE_TAMPERING: |- - SAVE_TAMPERING: |-
# A dark fog creeps in to surround you. From somewhere in the fog you A dark fog creeps in to surround you. From somewhere in the fog you
# hear a stern voice. "This Adventure has been tampered with! You have hear a stern voice. "This Adventure has been tampered with! You have
# been dabbling in magic, knowing not the havoc you might cause thereby. been dabbling in magic, knowing not the havoc you might cause thereby.
# Leave at once, before you do irrevocable harm!" The fog thickens, Leave at once, before you do irrevocable harm!" The fog thickens,
# until at last you can see nothing at all. Your vision then clears, until at last you can see nothing at all. Your vision then clears,
# and you find yourself back in The Real World. and you find yourself back in The Real World.
- TWIST_TURN: |- - TWIST_TURN: |-
Sorry, but the path twisted and turned so much that I can't figure Sorry, but the path twisted and turned so much that I can't figure
out which way to go to get back. out which way to go to get back.

View file

@ -137,7 +137,10 @@ int restore(FILE* fp)
fclose(fp); fclose(fp);
if (save.version != VRSION) { if (save.version != VRSION) {
rspeak(VERSION_SKEW, save.version / 10, MOD(save.version, 10), VRSION / 10, MOD(VRSION, 10)); 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; game = save.game;
} }
return GO_TOP; return GO_TOP;

View file

@ -10,15 +10,9 @@ down a gully.
> resume > resume
Can't open file y, try again. Can't open file y, try again.
You're in front of building. A dark fog creeps in to surround you. From somewhere in the fog you
hear a stern voice. "This Adventure has been tampered with! You have
> blast been dabbling in magic, knowing not the havoc you might cause thereby.
Leave at once, before you do irrevocable harm!" The fog thickens,
Blasting requires dynamite. until at last you can see nothing at all. Your vision then clears,
and you find yourself back in The Real World.
You scored 32 out of a possible 430, using 2 turns.
You are obviously a rank amateur. Better luck next time.
To achieve the next higher rating, you need 14 more points.