From 08e7bb1bf4a6937bb4b50b6eaf4631cc04655ae5 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Thu, 28 Nov 2019 17:49:14 +0300 Subject: [PATCH] engine: common: enable our own build number counter, move legacy to Q_buildnum_compat --- engine/common/build.c | 22 ++++++++++++++++------ engine/common/common.h | 4 +++- engine/common/host.c | 6 ++---- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/engine/common/build.c b/engine/common/build.c index 62fe9bfe..d124f18d 100644 --- a/engine/common/build.c +++ b/engine/common/build.c @@ -19,11 +19,9 @@ static char *date = __DATE__ ; static char *mon[12] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; static char mond[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; -// returns days since Feb 13 2007 +// returns days since Apr 1 2015 int Q_buildnum( void ) { -// do not touch this! Only author of Xash3D can increase buildnumbers! -#if 0 int m = 0, d = 0, y = 0; static int b = 0; @@ -44,12 +42,24 @@ int Q_buildnum( void ) { b += 1; } - b -= 38752; // Feb 13 2007 + b -= 41728; // Apr 1 2015 return b; -#else +} + +/* +============= +Q_buildnum_compat + +Returns a Xash3D build number. This is left for compability with original Xash3D. +IMPORTANT: this value must be changed ONLY after updating to newer Xash3D +IMPORTANT: this value must be acquired through "build" cvar. +============= +*/ +int Q_buildnum_compat( void ) +{ + // do not touch this! Only author of Xash3D can increase buildnumbers! return 4529; -#endif } /* diff --git a/engine/common/common.h b/engine/common/common.h index a4e7ae54..b1fdd635 100644 --- a/engine/common/common.h +++ b/engine/common/common.h @@ -119,7 +119,8 @@ typedef enum #include "con_nprint.h" #include "crclib.h" -#define XASH_VERSION "0.99" // engine current version +#define XASH_VERSION "0.20" // engine current version +#define XASH_COMPAT_VERSION "0.99" // version we are based on // PERFORMANCE INFO #define MIN_FPS 20.0f // host minimum fps value for maxfps. @@ -664,6 +665,7 @@ uint Sound_GetApproxWavePlayLen( const char *filepath ); // build.c // int Q_buildnum( void ); +int Q_buildnum_compat( void ); const char *Q_buildos( void ); const char *Q_buildarch( void ); const char *Q_buildcommit( void ); diff --git a/engine/common/host.c b/engine/common/host.c index a1ef6cea..fb5b5d08 100644 --- a/engine/common/host.c +++ b/engine/common/host.c @@ -960,10 +960,8 @@ int EXPORT Host_Main( int argc, char **argv, const char *progname, int bChangeGa host_limitlocal = Cvar_Get( "host_limitlocal", "0", 0, "apply cl_cmdrate and rate to loopback connection" ); con_gamemaps = Cvar_Get( "con_mapfilter", "1", FCVAR_ARCHIVE, "when true show only maps in game folder" ); - build = Cvar_Get( "buildnum", va( "%i", Q_buildnum()), FCVAR_READ_ONLY, "returns a current build number" ); - - ver = Cvar_Get( "ver", va( "%i/%s (hw build %i)", PROTOCOL_VERSION, XASH_VERSION, Q_buildnum()), FCVAR_READ_ONLY, "shows an engine version" ); - + build = Cvar_Get( "buildnum", va( "%i", Q_buildnum_compat()), FCVAR_READ_ONLY, "returns a current build number" ); + ver = Cvar_Get( "ver", va( "%i/%s (hw build %i)", PROTOCOL_VERSION, XASH_COMPAT_VERSION, Q_buildnum_compat()), FCVAR_READ_ONLY, "shows an engine version" ); Cvar_Get( "host_ver", va( "%i %s %s %s %s", Q_buildnum(), XASH_VERSION, Q_buildos(), Q_buildarch(), Q_buildcommit() ), FCVAR_READ_ONLY, "detailed info about this build" ); Mod_Init();