go.omoves to svo.omoves since it is read from savefile

This commit is contained in:
nhmall
2025-04-16 12:45:32 -04:00
parent 86bfb3e2f9
commit e024cbc57a
4 changed files with 10 additions and 8 deletions

View File

@@ -732,7 +732,6 @@ struct instance_globals_o {
/* restore.c */
struct fruit *oldfruit;
long omoves;
/* rumors.c */
int oracle_flg; /* -1=>don't use, 0=>need init, 1=>init done */
@@ -1170,6 +1169,8 @@ struct instance_globals_saved_n {
struct instance_globals_saved_o {
/* rumors.c */
unsigned oracle_cnt; /* oracles are handled differently from rumors... */
/* other */
long omoves; /* level timestamp */
};
struct instance_globals_saved_p {

View File

@@ -117,7 +117,6 @@ const char ynNaqchars[] = "yn#aq";
const char rightleftchars[] = "rl";
const char hidespinchars[] = "hsq";
NEARDATA long yn_number = 0L;
#ifdef PANICTRACE
const char *ARGV0;
#endif
@@ -601,7 +600,6 @@ static const struct instance_globals_o g_init_o = {
0, /* oldcap */
/* restore.c */
UNDEFINED_PTR, /* oldfruit */
0L, /* omoves */
/* rumors.c */
0, /* oracle_flag */
UNDEFINED_PTR, /* oracle_loc */
@@ -931,7 +929,9 @@ static const struct instance_globals_saved_n init_svn = {
static const struct instance_globals_saved_o init_svo = {
/* rumors.c */
0U /* oracle_cnt */
0U, /* oracle_cnt */
/* other */
0L /* omoves */
};
static const struct instance_globals_saved_p init_svp = {

View File

@@ -171,7 +171,7 @@ restdamage(NHFILE *nhfp)
}
if (ghostly)
tmp_dam->when += (svm.moves - go.omoves);
tmp_dam->when += (svm.moves - svo.omoves);
tmp_dam->next = svl.level.damagelist;
svl.level.damagelist = tmp_dam;
@@ -276,7 +276,7 @@ restobjchn(NHFILE *nhfp, boolean frozen)
* immediately after old player died.
*/
if (ghostly && !frozen && !age_is_relative(otmp))
otmp->age = svm.moves - go.omoves + otmp->age;
otmp->age = svm.moves - svo.omoves + otmp->age;
/* get contents of a container or statue */
if (Has_contents(otmp)) {
@@ -1081,8 +1081,8 @@ getlev(NHFILE *nhfp, int pid, xint8 lev)
Mread(nhfp->fd, &svl.lastseentyp[c][r], sizeof (schar));
}
}
Mread(nhfp->fd, &go.omoves, sizeof go.omoves);
elapsed = svm.moves - go.omoves;
Mread(nhfp->fd, &svo.omoves, sizeof svo.omoves);
elapsed = svm.moves - svo.omoves;
rest_stairs(nhfp);
if (nhfp->structlevel) {

View File

@@ -316,6 +316,7 @@ savegamestate(NHFILE *nhfp)
save_dungeon(nhfp, (boolean) !!perform_bwrite(nhfp),
(boolean) !!release_data(nhfp));
savelevchn(nhfp);
/* svm.moves below will actually be read back into svo.omoves on restore */
if (nhfp->structlevel) {
bwrite(nhfp->fd, (genericptr_t) &svm.moves, sizeof svm.moves);
bwrite(nhfp->fd, (genericptr_t) &svq.quest_status,