X-Git-Url: https://jxself.org/git/?p=open-adventure.git;a=blobdiff_plain;f=saveresume.c;h=d8541748fbf25fe573770562028838c65248ac7a;hp=c275986f4e85bf0d2358d17581391c449fcd110b;hb=cf92b9d9d624d983277bd32d8d59de0152d97721;hpb=ad3b097c9e587c1474cc1cac93f89ada853902ff diff --git a/saveresume.c b/saveresume.c index c275986..d854174 100644 --- a/saveresume.c +++ b/saveresume.c @@ -1,6 +1,7 @@ #include #include #include +#include #include "advent.h" #include "dungeon.h" @@ -10,7 +11,7 @@ * see the history.adoc file in the source distribution for discussion. */ -#define VRSION 26 /* bump on save format change */ +#define VRSION 27 /* bump on save format change */ /* * If you change the first three members, the resume function may not properly @@ -31,15 +32,11 @@ struct save_t save; int savefile(FILE *fp, long version) /* Save game to file. No input or output from user. */ { - long i, k; - datime(&i, &k); - k = i + 650 * k; - save.savetime = k; + save.savetime = time(NULL); save.mode = -1; - save.version = (version == 0) ? VRSION : version; - memcpy(&save.game, &game, sizeof(struct game_t)); + save.game = game; IGNORE(fwrite(&save, sizeof(struct save_t), 1, fp)); return (0); } @@ -88,7 +85,8 @@ int resume(void) #endif FILE *fp = NULL; - if (game.loc != 1 || game.abbrev[1] != 1) { + if (game.loc != 1 || + game.abbrev[1] != 1) { rspeak(RESUME_ABANDON); if (!yes(arbitrary_messages[THIS_ACCEPTABLE], arbitrary_messages[OK_MAN], arbitrary_messages[OK_MAN])) return GO_CLEAROBJ; @@ -121,9 +119,7 @@ int restore(FILE* fp) if (save.version != VRSION) { rspeak(VERSION_SKEW, save.version / 10, MOD(save.version, 10), VRSION / 10, MOD(VRSION, 10)); } else { - memcpy(&game, &save.game, sizeof(struct game_t)); - //game.zzword = rndvoc(3, game.zzword); - make_zzword(game.zzword); + game = save.game; } return GO_TOP; }