From: NHOrus Date: Sat, 17 Jun 2017 14:24:45 +0000 (+0300) Subject: Improved docs, fixed identation X-Git-Tag: 1.1~278 X-Git-Url: https://jxself.org/git/?p=open-adventure.git;a=commitdiff_plain;h=a0a35d8c7b8ed65230748647ff3c40e8119a643f Improved docs, fixed identation --- diff --git a/advent.adoc b/advent.adoc index c1075e6..d0fd29b 100644 --- a/advent.adoc +++ b/advent.adoc @@ -39,6 +39,8 @@ There have been no gameplay changes. -s:: Suppress Emacs-like line editing and command history. +-r:: Restore game from specified file + -o:: Old-style. Restores original interface, no prompt or line editing. == BUGS == diff --git a/main.c b/main.c index 706b298..3a7c7db 100644 --- a/main.c +++ b/main.c @@ -95,13 +95,13 @@ int main(int argc, char *argv[]) editline = prompt = false; break; case 'r': - rfp = fopen(optarg, "r"); - if (rfp == NULL) - fprintf(stderr, - "advent: can't open save file %s for read\n", - optarg); - signal(SIGINT, sig_handler); - break; + rfp = fopen(optarg, "r"); + if (rfp == NULL) + fprintf(stderr, + "advent: can't open save file %s for read\n", + optarg); + signal(SIGINT, sig_handler); + break; case 's': editline = false; break; diff --git a/notes.adoc b/notes.adoc index f1716ba..00a733a 100644 --- a/notes.adoc +++ b/notes.adoc @@ -73,8 +73,8 @@ necessarily pretty ugly by modern standards. Encryption and checksumming have been discarded - it's pointless to try tamper-proofing saves when everyone has the source code. -A -r command-line option has been added. It is functionally equivalent -to RESTORE command, but faster. +A -r command-line been added. When it is given (with a file +path argument) it is functionally equivalent to RESTORE command. == Translation == diff --git a/saveresume.c b/saveresume.c index 676fa24..015b4be 100644 --- a/saveresume.c +++ b/saveresume.c @@ -93,14 +93,14 @@ int restore(FILE* fp){ IGNORE(fread(&save, sizeof(struct save_t), 1, fp)); fclose(fp); if (save.version != VRSION) { - SETPRM(1,save.version/10,MOD(save.version,10)); - SETPRM(3,VRSION/10,MOD(VRSION,10)); - RSPEAK(VERSION_SKEW); + SETPRM(1,save.version/10,MOD(save.version,10)); + SETPRM(3,VRSION/10,MOD(VRSION,10)); + RSPEAK(VERSION_SKEW); } else { - memcpy(&game, &save.game, sizeof(struct game_t)); - OBJSND[BIRD] = save.bird; - OBJTXT[OYSTER] = save.bivalve; - game.zzword=RNDVOC(3,game.zzword); + memcpy(&game, &save.game, sizeof(struct game_t)); + OBJSND[BIRD] = save.bird; + OBJTXT[OYSTER] = save.bivalve; + game.zzword=RNDVOC(3,game.zzword); } return GO_TOP; }