From 969960a1ebbcd0c4907a9fa110d1b6cf5da2c5b3 Mon Sep 17 00:00:00 2001 From: mazmazz Date: Thu, 20 Dec 2018 02:14:41 -0500 Subject: [PATCH] Adjust EXECVERSION define scheme* MAJOREXECVERSION and MINOREXECVERSION* GETEXECVERSION(major, minor) macro --- src/doomdef.h | 16 ++++++++++++---- src/m_misc.c | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/doomdef.h b/src/doomdef.h index 0485698d..0e059cd1 100644 --- a/src/doomdef.h +++ b/src/doomdef.h @@ -216,11 +216,19 @@ extern FILE *logstream; // Note that we use this to help keep internal testing in check; this is why v2.1.0 is not version "1". #define MODVERSION 26 -// To version config.cfg, EXECVERSION was originally equal to MODVERSION -// So keep it equal to MODVERSION, and increment MINOREXECVERSION whenever a config change -// is needed that does not correspond to an increment in MODVERSION -#define EXECVERSION 26 +// To version config.cfg, set MAJOREXECVERSION equal to MODVERSION +// and increment SUBEXECVERSION whenever a config change is needed +// that does not correspond to an increment in MODVERSION. +// If MAJOREXECVERSION increases, set MINOREXECVERSION to 0. +#define MAJOREXECVERSION 26 #define MINOREXECVERSION 1 +// (It would have been nice to use VERSION and SUBVERSION but those are different for DEVELOP builds) + +// Macros +#define GETMAJOREXECVERSION(v) (v & 0xFFFF) +#define GETMINOREXECVERSION(v) (v >> 16) +#define GETEXECVERSION(major,minor) (major + (minor << 16)) +#define EXECVERSION GETEXECVERSION(MAJOREXECVERSION, MINOREXECVERSION) // ========================================================================= diff --git a/src/m_misc.c b/src/m_misc.c index 556e56a2..1b92a8c4 100644 --- a/src/m_misc.c +++ b/src/m_misc.c @@ -563,7 +563,7 @@ void M_SaveConfig(const char *filename) // print execversion FIRST, because subsequent consvars need to be filtered // always print current EXECVERSION - fprintf(f, "%s \"%d\"\n", cv_execversion.name, (EXECVERSION + (MINOREXECVERSION << 16))); + fprintf(f, "%s \"%d\"\n", cv_execversion.name, EXECVERSION); // FIXME: save key aliases if ever implemented..