projects
/
open-adventure.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Interim magic number replacement.
[open-adventure.git]
/
saveresume.c
diff --git
a/saveresume.c
b/saveresume.c
index d2913615ab9e0d078f9a2b0bf91321dbd1fe8c61..3ec4ebd11b0aa1a192ea145e99c689d44295b616 100644
(file)
--- a/
saveresume.c
+++ b/
saveresume.c
@@
-2,8
+2,7
@@
#include <string.h>
#include "advent.h"
#include <string.h>
#include "advent.h"
-#include "database.h"
-#include "newdb.h"
+#include "dungeon.h"
#include "linenoise/linenoise.h"
/*
#include "linenoise/linenoise.h"
/*
@@
-27,20
+26,22
@@
struct save_t {
};
struct save_t save;
};
struct save_t save;
+#define IGNORE(r) do{if (r){}}while(0)
+
int savefile(FILE *fp, long version)
int savefile(FILE *fp, long version)
-
/* Save game to file. No input or output from user. */
+/* Save game to file. No input or output from user. */
{
long i, k;
datime(&i, &k);
k = i + 650 * k;
save.savetime = k;
save.mode = -1;
{
long i, k;
datime(&i, &k);
k = i + 650 * k;
save.savetime = k;
save.mode = -1;
-
+
save.version = (version == 0) ? VRSION : version;
save.version = (version == 0) ? VRSION : version;
-
+
memcpy(&save.game, &game, sizeof(struct game_t));
IGNORE(fwrite(&save, sizeof(struct save_t), 1, fp));
memcpy(&save.game, &game, sizeof(struct game_t));
IGNORE(fwrite(&save, sizeof(struct save_t), 1, fp));
- return(0);
+ return
(0);
}
/* Suspend and resume */
}
/* Suspend and resume */
@@
-57,7
+58,8
@@
int suspend(void)
FILE *fp = NULL;
rspeak(SUSPEND_WARNING);
FILE *fp = NULL;
rspeak(SUSPEND_WARNING);
- if (!yes(arbitrary_messages[THIS_ACCEPTABLE], arbitrary_messages[OK_MAN], arbitrary_messages[OK_MAN])) return GO_CLEAROBJ;
+ if (!yes(arbitrary_messages[THIS_ACCEPTABLE], arbitrary_messages[OK_MAN], arbitrary_messages[OK_MAN]))
+ return GO_CLEAROBJ;
game.saved = game.saved + 5;
while (fp == NULL) {
game.saved = game.saved + 5;
while (fp == NULL) {
@@
-73,7
+75,7
@@
int suspend(void)
savefile(fp, VRSION);
fclose(fp);
rspeak(RESUME_HELP);
savefile(fp, VRSION);
fclose(fp);
rspeak(RESUME_HELP);
- exit(
0
);
+ exit(
EXIT_SUCCESS
);
}
int resume(void)
}
int resume(void)
@@
-88,7
+90,8
@@
int resume(void)
if (game.loc != 1 || game.abbrev[1] != 1) {
rspeak(RESUME_ABANDON);
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;
+ if (!yes(arbitrary_messages[THIS_ACCEPTABLE], arbitrary_messages[OK_MAN], arbitrary_messages[OK_MAN]))
+ return GO_CLEAROBJ;
}
while (fp == NULL) {
}
while (fp == NULL) {
@@
-120,7
+123,7
@@
int restore(FILE* fp)
} else {
memcpy(&game, &save.game, sizeof(struct game_t));
//game.zzword = rndvoc(3, game.zzword);
} else {
memcpy(&game, &save.game, sizeof(struct game_t));
//game.zzword = rndvoc(3, game.zzword);
- make_zzword(game.zzword);
+
make_zzword(game.zzword);
}
return GO_TOP;
}
}
return GO_TOP;
}