ignoring features when checking version compat
The nomakedefs stuff for cross-compiling support broke the code to treat enabling or disabling some optional features as not breaking save and bones file compatibility. It was relying on a macro whose definition was local to mdlib.c rather than propagated among files. makedefs still constructs date.h with a value indicating the ignored features but the actual compatability check doesn't use that anymore. Toggling SCORE_ON_BOTL shouldn't have caused existing files to be rejected but they were.
This commit is contained in:
+3
-1
@@ -1,4 +1,4 @@
|
|||||||
HDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.949 $ $NHDT-Date: 1655065133 2022/06/12 20:18:53 $
|
HDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.951 $ $NHDT-Date: 1655402422 2022/06/16 18:00:22 $
|
||||||
|
|
||||||
General Fixes and Modified Features
|
General Fixes and Modified Features
|
||||||
-----------------------------------
|
-----------------------------------
|
||||||
@@ -1254,6 +1254,8 @@ earlier fix for prices of unpaid objects going away in persistent inventory
|
|||||||
display when hero bought something during itemized billing didn't work
|
display when hero bought something during itemized billing didn't work
|
||||||
if paying for a used-up shop item--prices of any unpaid items vanished
|
if paying for a used-up shop item--prices of any unpaid items vanished
|
||||||
when inventory got updated to reflect transfer of hero's gold to shk
|
when inventory got updated to reflect transfer of hero's gold to shk
|
||||||
|
save files created with SCORE_ON_BOTL disabled were erroneously being rejected
|
||||||
|
if the program was rebuilt with it enabled and vice versa
|
||||||
|
|
||||||
curses: 'msg_window' option wasn't functional for curses unless the binary
|
curses: 'msg_window' option wasn't functional for curses unless the binary
|
||||||
also included tty support
|
also included tty support
|
||||||
|
|||||||
+3
-4
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.7 date.c $NHDT-Date: 1645393645 2022/02/20 21:47:25 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.2 $ */
|
/* NetHack 3.7 date.c $NHDT-Date: 1655402414 2022/06/16 18:00:14 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.3 $ */
|
||||||
/* Copyright (c) Michael Allison, 2021. */
|
/* Copyright (c) Michael Allison, 2021. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -12,6 +12,7 @@ void free_nomakedefs(void);
|
|||||||
nh_snprintf(__func__, __LINE__, str, size, __VA_ARGS__)
|
nh_snprintf(__func__, __LINE__, str, size, __VA_ARGS__)
|
||||||
extern void nh_snprintf(const char *func, int line, char *str, size_t size,
|
extern void nh_snprintf(const char *func, int line, char *str, size_t size,
|
||||||
const char *fmt, ...);
|
const char *fmt, ...);
|
||||||
|
extern unsigned long md_ignored_features(void);
|
||||||
extern char *mdlib_version_string(char *, const char *);
|
extern char *mdlib_version_string(char *, const char *);
|
||||||
extern char *version_id_string(char *, int, const char *);
|
extern char *version_id_string(char *, int, const char *);
|
||||||
extern char *bannerc_string(char *, int, const char *);
|
extern char *bannerc_string(char *, int, const char *);
|
||||||
@@ -108,9 +109,7 @@ populate_nomakedefs(struct version_info *version)
|
|||||||
|
|
||||||
nomakedefs.version_number = version->incarnation;
|
nomakedefs.version_number = version->incarnation;
|
||||||
nomakedefs.version_features = version->feature_set;
|
nomakedefs.version_features = version->feature_set;
|
||||||
#ifdef MD_IGNORED_FEATURES
|
nomakedefs.ignored_features = md_ignored_features();
|
||||||
nomakedefs.ignored_features = MD_IGNORED_FEATURES;
|
|
||||||
#endif
|
|
||||||
nomakedefs.version_sanity1 = version->entity_count;
|
nomakedefs.version_sanity1 = version->entity_count;
|
||||||
nomakedefs.version_sanity2 = version->struct_sizes1;
|
nomakedefs.version_sanity2 = version->struct_sizes1;
|
||||||
nomakedefs.version_sanity3 = version->struct_sizes2;
|
nomakedefs.version_sanity3 = version->struct_sizes2;
|
||||||
|
|||||||
+20
-8
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.7 mdlib.c $NHDT-Date: 1644524060 2022/02/10 20:14:20 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.27 $ */
|
/* NetHack 3.7 mdlib.c $NHDT-Date: 1655402414 2022/06/16 18:00:14 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.31 $ */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/*-Copyright (c) Kenneth Lorber, Kensington, Maryland, 2015. */
|
/*-Copyright (c) Kenneth Lorber, Kensington, Maryland, 2015. */
|
||||||
/* Copyright (c) M. Stephenson, 1990, 1991. */
|
/* Copyright (c) M. Stephenson, 1990, 1991. */
|
||||||
@@ -53,6 +53,7 @@
|
|||||||
/* REPRODUCIBLE_BUILD will change this to TRUE */
|
/* REPRODUCIBLE_BUILD will change this to TRUE */
|
||||||
static boolean date_via_env = FALSE;
|
static boolean date_via_env = FALSE;
|
||||||
|
|
||||||
|
extern unsigned long md_ignored_features(void);
|
||||||
char *mdlib_version_string(char *, const char *);
|
char *mdlib_version_string(char *, const char *);
|
||||||
char *version_id_string(char *, int, const char *);
|
char *version_id_string(char *, int, const char *);
|
||||||
char *bannerc_string(char *, int, const char *);
|
char *bannerc_string(char *, int, const char *);
|
||||||
@@ -169,13 +170,15 @@ static struct win_info window_opts[] = {
|
|||||||
* That check is done in src/restore.c now.
|
* That check is done in src/restore.c now.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#ifndef MD_IGNORED_FEATURES
|
unsigned long
|
||||||
#define MD_IGNORED_FEATURES \
|
md_ignored_features(void)
|
||||||
(0L | (1L << 19) /* SCORE_ON_BOTL */ \
|
{
|
||||||
| (1L << 27) /* ZEROCOMP */ \
|
return (0UL
|
||||||
| (1L << 28) /* RLECOMP */ \
|
| (1UL << 19) /* SCORE_ON_BOTL */
|
||||||
)
|
| (1UL << 27) /* ZEROCOMP */
|
||||||
#endif /* MD_IGNORED_FEATUES */
|
| (1UL << 28) /* RLECOMP */
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
make_version(void)
|
make_version(void)
|
||||||
@@ -454,6 +457,9 @@ static const char *const build_opts[] = {
|
|||||||
"data librarian with a version-dependent name",
|
"data librarian with a version-dependent name",
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef EDIT_GETLIN
|
||||||
|
"edit getlin - some prompts remember previous response",
|
||||||
|
#endif
|
||||||
#ifdef DUMPLOG
|
#ifdef DUMPLOG
|
||||||
"end-of-game dumplogs",
|
"end-of-game dumplogs",
|
||||||
#endif
|
#endif
|
||||||
@@ -473,6 +479,9 @@ static const char *const build_opts[] = {
|
|||||||
#ifdef INSURANCE
|
#ifdef INSURANCE
|
||||||
"insurance files for recovering from crashes",
|
"insurance files for recovering from crashes",
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef LIVELOG
|
||||||
|
"live logging support",
|
||||||
|
#endif
|
||||||
#ifdef LOGFILE
|
#ifdef LOGFILE
|
||||||
"log file",
|
"log file",
|
||||||
#endif
|
#endif
|
||||||
@@ -485,6 +494,9 @@ static const char *const build_opts[] = {
|
|||||||
#ifdef MAIL
|
#ifdef MAIL
|
||||||
"mail daemon",
|
"mail daemon",
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef MONITOR_HEAP
|
||||||
|
"monitor heap - record memory usage for later analysis",
|
||||||
|
#endif
|
||||||
#if defined(GNUDOS) || defined(__DJGPP__)
|
#if defined(GNUDOS) || defined(__DJGPP__)
|
||||||
"MSDOS protected mode",
|
"MSDOS protected mode",
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+11
-11
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.7 version.c $NHDT-Date: 1654069065 2022/06/01 07:37:45 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.91 $ */
|
/* NetHack 3.7 version.c $NHDT-Date: 1655402415 2022/06/16 18:00:15 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.92 $ */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/*-Copyright (c) Michael Allison, 2018. */
|
/*-Copyright (c) Michael Allison, 2018. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
@@ -295,11 +295,14 @@ comp_times(long filetime)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
boolean
|
boolean
|
||||||
check_version(struct version_info *version_data, const char *filename,
|
check_version(
|
||||||
boolean complain, unsigned long utdflags)
|
struct version_info *version_data,
|
||||||
|
const char *filename,
|
||||||
|
boolean complain,
|
||||||
|
unsigned long utdflags)
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
#ifdef VERSION_COMPATIBILITY
|
#ifdef VERSION_COMPATIBILITY /* patchlevel.h */
|
||||||
version_data->incarnation < VERSION_COMPATIBILITY
|
version_data->incarnation < VERSION_COMPATIBILITY
|
||||||
|| version_data->incarnation > nomakedefs.version_number
|
|| version_data->incarnation > nomakedefs.version_number
|
||||||
#else
|
#else
|
||||||
@@ -312,18 +315,15 @@ check_version(struct version_info *version_data, const char *filename,
|
|||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else if (
|
} else if (
|
||||||
#ifndef IGNORED_FEATURES
|
|
||||||
version_data->feature_set != nomakedefs.version_features
|
|
||||||
#else
|
|
||||||
(version_data->feature_set & ~nomakedefs.ignored_features)
|
(version_data->feature_set & ~nomakedefs.ignored_features)
|
||||||
!= (VERSION_FEATURES & ~nomakedefs.ignored_features)
|
!= (nomakedefs.version_features & ~nomakedefs.ignored_features)
|
||||||
#endif
|
|
||||||
|| ((utdflags & UTD_SKIP_SANITY1) == 0
|
|| ((utdflags & UTD_SKIP_SANITY1) == 0
|
||||||
&& version_data->entity_count != nomakedefs.version_sanity1)
|
&& version_data->entity_count != nomakedefs.version_sanity1)
|
||||||
|| ((utdflags & UTD_CHECKSIZES) != 0
|
|| ((utdflags & UTD_CHECKSIZES) != 0
|
||||||
&& version_data->struct_sizes1 != nomakedefs.version_sanity2)
|
&& version_data->struct_sizes1 != nomakedefs.version_sanity2)
|
||||||
|| ((utdflags & UTD_CHECKSIZES) != 0
|
|| ((utdflags & UTD_CHECKSIZES) != 0
|
||||||
&& version_data->struct_sizes2 != nomakedefs.version_sanity3)) {
|
&& version_data->struct_sizes2 != nomakedefs.version_sanity3)
|
||||||
|
) {
|
||||||
if (complain) {
|
if (complain) {
|
||||||
pline("Configuration incompatibility for file \"%s\".", filename);
|
pline("Configuration incompatibility for file \"%s\".", filename);
|
||||||
display_nhwindow(WIN_MESSAGE, TRUE);
|
display_nhwindow(WIN_MESSAGE, TRUE);
|
||||||
@@ -390,7 +390,7 @@ void
|
|||||||
store_version(NHFILE *nhfp)
|
store_version(NHFILE *nhfp)
|
||||||
{
|
{
|
||||||
struct version_info version_data = {
|
struct version_info version_data = {
|
||||||
0UL,0UL,0UL,0UL,0Ul
|
0UL, 0UL, 0UL, 0UL, 0UL
|
||||||
};
|
};
|
||||||
|
|
||||||
/* actual version number */
|
/* actual version number */
|
||||||
|
|||||||
+6
-4
@@ -1,4 +1,4 @@
|
|||||||
/* NetHack 3.7 makedefs.c $NHDT-Date: 1645393932 2022/02/20 21:52:12 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.211 $ */
|
/* NetHack 3.7 makedefs.c $NHDT-Date: 1655402416 2022/06/16 18:00:16 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.215 $ */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/*-Copyright (c) Kenneth Lorber, Kensington, Maryland, 2015. */
|
/*-Copyright (c) Kenneth Lorber, Kensington, Maryland, 2015. */
|
||||||
/* Copyright (c) M. Stephenson, 1990, 1991. */
|
/* Copyright (c) M. Stephenson, 1990, 1991. */
|
||||||
@@ -1285,10 +1285,12 @@ do_date(void)
|
|||||||
ul_sfx);
|
ul_sfx);
|
||||||
Fprintf(ofp, "#define VERSION_FEATURES 0x%08lx%s\n", version.feature_set,
|
Fprintf(ofp, "#define VERSION_FEATURES 0x%08lx%s\n", version.feature_set,
|
||||||
ul_sfx);
|
ul_sfx);
|
||||||
#ifdef MD_IGNORED_FEATURES
|
{
|
||||||
|
unsigned long ignored_features = md_ignored_features();
|
||||||
|
|
||||||
Fprintf(ofp, "#define IGNORED_FEATURES 0x%08lx%s\n",
|
Fprintf(ofp, "#define IGNORED_FEATURES 0x%08lx%s\n",
|
||||||
(unsigned long) MD_IGNORED_FEATURES, ul_sfx);
|
ignored_features, ul_sfx);
|
||||||
#endif
|
}
|
||||||
Fprintf(ofp, "#define VERSION_SANITY1 0x%08lx%s\n", version.entity_count,
|
Fprintf(ofp, "#define VERSION_SANITY1 0x%08lx%s\n", version.entity_count,
|
||||||
ul_sfx);
|
ul_sfx);
|
||||||
#ifndef __EMSCRIPTEN__
|
#ifndef __EMSCRIPTEN__
|
||||||
|
|||||||
Reference in New Issue
Block a user