fix compatability checking for development

It is astounding that after all this time no one noticed that
incrementing EDITLEVEL wasn't doing the job it's intended to do.
Diagnosed by entrez:  since VERSION_COMPATIBILITY was defined as
3.7.0-0 and up, increasing the fourth component wasn't resulting in
old 3.7.0-x files being rejected.

This increments EDITLEVEL yet again, because my testing after
commenting out VERSION_COMPATIBILITY still wasn't rejecting older
files.  Proably because the oldest I had available already had the
verison info with the preceding EDITLEVEL so weren't actually out
of date yet.

Once I had old files be rejected, I discovered that the rejection
message was invisible (for tty on OSX).  The message line showed
spaces, matching the length of the intended message, followed by
--More--.  This fixes that too.
This commit is contained in:
PatR
2022-04-29 22:37:13 -07:00
parent b8ee09b843
commit 0efa1d60b7
3 changed files with 23 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
HDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.892 $ $NHDT-Date: 1650963745 2022/04/26 09:02:25 $ HDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.902 $ $NHDT-Date: 1651297020 2022/04/30 05:37:00 $
General Fixes and Modified Features General Fixes and Modified Features
----------------------------------- -----------------------------------
@@ -901,10 +901,15 @@ for force-fight against edge of level, report "you harmlessly attack unknown
using wizard mode ^V in endgame to return to previously visited Plane of Water using wizard mode ^V in endgame to return to previously visited Plane of Water
now gets the same air bubbles back instead of a replacement set; now gets the same air bubbles back instead of a replacement set;
likewise for clouds on Plane of Air likewise for clouds on Plane of Air
on tty at least, "version incompatibility for save/123xyzzy" was invisible:
a blank message of appropriate length followed by --More--
Fixes to 3.7.0-x Problems that Were Exposed Via git Repository Fixes to 3.7.0-x Problems that Were Exposed Via git Repository
------------------------------------------------------------------ ------------------------------------------------------------------
incrementing EDITLEVEL to invalidate incompatible save files was not working
as intended because VERSION_COMPABILITY was defined as 3.7.0-0 and up
rather than as 3.7.0-N for the current EDITLEVEL 'N'; undefine it
fix compile when DLB isn't defined fix compile when DLB isn't defined
urealtime.realtime was being incorrectly calculated urealtime.realtime was being incorrectly calculated
revised "mysterious force" when climbing out of gehennom could generate revised "mysterious force" when climbing out of gehennom could generate

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 patchlevel.h $NHDT-Date: 1646870832 2022/03/10 00:07:12 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.202 $ */ /* NetHack 3.7 patchlevel.h $NHDT-Date: 1651297020 2022/04/30 05:37:00 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.207 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2012. */ /*-Copyright (c) Michael Allison, 2012. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -17,7 +17,7 @@
* Incrementing EDITLEVEL can be used to force invalidation of old bones * Incrementing EDITLEVEL can be used to force invalidation of old bones
* and save files. * and save files.
*/ */
#define EDITLEVEL 56 #define EDITLEVEL 57
/* /*
* Development status possibilities. * Development status possibilities.
@@ -51,8 +51,15 @@
* 0x = literal prefix "0x", MM = major version, mm = minor version, * 0x = literal prefix "0x", MM = major version, mm = minor version,
* PP = patch level, ee = edit level, L = literal suffix "L", * PP = patch level, ee = edit level, L = literal suffix "L",
* with all four numbers specified as two hexadecimal digits. * with all four numbers specified as two hexadecimal digits.
*
* When developing a new version, VERSION_COMPATIBILITY should be
* commented out so that increments of EDITLEVEL can be used to forcibly
* invalidate existing save files whenever incompatible changes are made
* to saved data. [Bones files should be less sensitive (only changes
* to individual level files matter; changes to general game state don't)
* but the extra complexity to support that is not worth the effort.]
*/ */
#define VERSION_COMPATIBILITY 0x03070000L /*#define VERSION_COMPATIBILITY 0x03070000L*/
/****************************************************************************/ /****************************************************************************/
/* Version 3.7.x */ /* Version 3.7.x */

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 version.c $NHDT-Date: 1596498224 2020/08/03 23:43:44 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.74 $ */ /* NetHack 3.7 version.c $NHDT-Date: 1651297024 2022/04/30 05:37:04 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.88 $ */
/* 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. */
@@ -299,8 +299,10 @@ check_version(struct version_info *version_data, const char *filename,
version_data->incarnation != nomakedefs.version_number version_data->incarnation != nomakedefs.version_number
#endif #endif
) { ) {
if (complain) if (complain) {
pline("Version mismatch for file \"%s\".", filename); pline("Version mismatch for file \"%s\".", filename);
display_nhwindow(WIN_MESSAGE, TRUE);
}
return FALSE; return FALSE;
} else if ( } else if (
#ifndef IGNORED_FEATURES #ifndef IGNORED_FEATURES
@@ -315,8 +317,10 @@ check_version(struct version_info *version_data, const char *filename,
&& 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);
}
return FALSE; return FALSE;
} }
return TRUE; return TRUE;