engine: common: enable our own build number counter, move legacy to Q_buildnum_compat

This commit is contained in:
Alibek Omarov 2019-11-28 17:49:14 +03:00
parent d0010cf9cb
commit 08e7bb1bf4
3 changed files with 21 additions and 11 deletions

View File

@ -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
}
/*

View File

@ -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 );

View File

@ -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();