more storing only relative times in save & bones

This commit is contained in:
nhmall
2026-04-13 07:53:51 -04:00
parent 4bd3f8398e
commit efaabc3203
3 changed files with 11 additions and 1 deletions

View File

@@ -17,7 +17,7 @@
* Incrementing EDITLEVEL can be used to force invalidation of old bones
* and save files.
*/
#define EDITLEVEL 139
#define EDITLEVEL 140
/*
* Development status possibilities.

View File

@@ -353,6 +353,7 @@ restmon(NHFILE *nhfp, struct monst *mtmp)
Sfi_edog(nhfp, EDOG(mtmp), "monst-edog");
/* save or bones held a relative time */
relative_time_to_moves(&EDOG(mtmp)->droptime);
relative_time_to_moves(&EDOG(mtmp)->hungrytime);
/* sanity check to prevent rn2(0) */
if (EDOG(mtmp)->apport <= 0) {
EDOG(mtmp)->apport = 1;
@@ -552,6 +553,8 @@ restgamestate(NHFILE *nhfp)
#endif /* SFCTOOL */
newgamecontext = svc.context; /* copy statically init'd context */
Sfi_context_info(nhfp, &svc.context, "gamestate-context");
relative_time_to_moves(&svc.context.seer_turn);
relative_time_to_moves(&svc.context.digging.lastdigtime);
svc.context.warntype.species = (ismnum(svc.context.warntype.speciesidx))
? &mons[svc.context.warntype.speciesidx]
: (struct permonst *) 0;

View File

@@ -270,7 +270,12 @@ savegamestate(NHFILE *nhfp)
program_state.saving++; /* caller should/did already set this... */
uid = (unsigned long) getuid();
Sfo_ulong(nhfp, &uid, "gamestate-uid");
moves_to_relative_time(&svc.context.seer_turn);
moves_to_relative_time(&svc.context.digging.lastdigtime);
Sfo_context_info(nhfp, &svc.context, "gamestate-context");
relative_time_to_moves(&svc.context.seer_turn);
relative_time_to_moves(&svc.context.digging.lastdigtime);
Sfo_flag(nhfp, &flags, "gamestate-flags");
urealtime.finish_time = getnow();
urealtime.realtime += timet_delta(urealtime.finish_time,
@@ -855,8 +860,10 @@ savemon(NHFILE *nhfp, struct monst *mtmp)
if (buflen > 0) {
/* we only store relative times in save and bones */
moves_to_relative_time(&EDOG(mtmp)->droptime);
moves_to_relative_time(&EDOG(mtmp)->hungrytime);
Sfo_edog(nhfp, EDOG(mtmp), "monst-edog");
relative_time_to_moves(&EDOG(mtmp)->droptime);
relative_time_to_moves(&EDOG(mtmp)->hungrytime);
}
buflen = EBONES(mtmp) ? (int) sizeof (struct ebones) : 0;
Sfo_int(nhfp, &buflen, "monst-ebones_length");