From 8c8121eb3c7bca165d7ac02b6fdc88cdaf61faa6 Mon Sep 17 00:00:00 2001 From: nhmall Date: Mon, 13 Apr 2026 09:08:53 -0400 Subject: [PATCH] move a pair of functions from save.c to restore.c A utility that links only with restore.o needs to find them. --- include/extern.h | 4 ++-- src/cfgfiles.c | 2 ++ src/restore.c | 15 +++++++++++++++ src/save.c | 16 ---------------- util/sfctool.c | 2 +- 5 files changed, 20 insertions(+), 19 deletions(-) diff --git a/include/extern.h b/include/extern.h index fdaff14c4..66a5120b4 100644 --- a/include/extern.h +++ b/include/extern.h @@ -2734,6 +2734,8 @@ boolean restgamestate(NHFILE *); void restore_msghistory(NHFILE *); #endif extern void rest_adjust_levelflags(void); +extern void moves_to_relative_time(long *); +extern void relative_time_to_moves(long *); /* ### rip.c ### */ @@ -2828,8 +2830,6 @@ extern void freedynamicdata(void); extern void store_savefileinfo(NHFILE *) NONNULLARG1; extern void store_savefileinfo(NHFILE *) NONNULLARG1; extern int nhdatatypes_size(void); -extern void moves_to_relative_time(long *); -extern void relative_time_to_moves(long *); #if 0 extern void assignlog(char *, char*, int); extern FILE *getlog(NHFILE *); diff --git a/src/cfgfiles.c b/src/cfgfiles.c index 89ffbd4ab..2ba0c2fde 100644 --- a/src/cfgfiles.c +++ b/src/cfgfiles.c @@ -1889,6 +1889,7 @@ vconfig_error_add(const char *str, va_list the_args) config_erradd(buf); } +#ifndef SFCTOOL void rcfile(void) { @@ -2022,6 +2023,7 @@ config_unmatched_ignored(void) return TRUE; return FALSE; } +#endif /* SFCTOOL */ #ifdef SYSCF #ifdef SYSCF_FILE diff --git a/src/restore.c b/src/restore.c index 2c277de58..33066d662 100644 --- a/src/restore.c +++ b/src/restore.c @@ -1313,6 +1313,21 @@ rest_adjust_levelflags(void) /* adjust timestamps */ relative_time_to_moves(&svl.level.flags.stasis_until); } +void +moves_to_relative_time(long *timestamp) +{ + long prevts = *timestamp; + + *timestamp = prevts - svm.moves; +} + +void +relative_time_to_moves(long *timestamp) +{ + long prevts = *timestamp; + + *timestamp = svm.moves + prevts; +} /* "name-role-race-gend-algn" occurs very early in a save file; sometimes we want the whole thing, other times just "name" (for svp.plname[]) */ diff --git a/src/save.c b/src/save.c index eaae62fc9..fd6dfae2f 100644 --- a/src/save.c +++ b/src/save.c @@ -1052,22 +1052,6 @@ save_msghistory(NHFILE *nhfp) /* note: we don't attempt to handle release_data() here */ } -void -moves_to_relative_time(long *timestamp) -{ - long prevts = *timestamp; - - *timestamp = prevts - svm.moves; -} - -void -relative_time_to_moves(long *timestamp) -{ - long prevts = *timestamp; - - *timestamp = svm.moves + prevts; -} - /* also called by prscore(); this probably belongs in dungeon.c... */ void free_dungeons(void) diff --git a/util/sfctool.c b/util/sfctool.c index ab1ad4d97..9c9423861 100644 --- a/util/sfctool.c +++ b/util/sfctool.c @@ -96,7 +96,7 @@ int util_strncmpi(const char *s1, const char *s2, size_t sz); #ifdef UNIX #define nethack_exit exit ATTRNORETURN void nh_terminate(int) NORETURN; /* bwrite() calls this */ -static void chdirx(const char *, boolean); +//static void chdirx(const char *, boolean); #else ATTRNORETURN extern void nethack_exit(int) NORETURN; #ifdef WIN32