mirror of
https://github.com/w23/xash3d-fwgs
synced 2024-12-14 21:20:26 +01:00
public: build: split Q_buildnum to separate function that calculates build number from arbitrary date string
This commit is contained in:
parent
84fc8d4281
commit
e4a5b95e81
@ -16,27 +16,16 @@ GNU General Public License for more details.
|
||||
#include "crtlib.h"
|
||||
#include "buildenums.h"
|
||||
|
||||
static const char *date = __DATE__ ;
|
||||
static const char *mon[12] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
|
||||
static const char mond[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
|
||||
|
||||
/*
|
||||
===============
|
||||
Q_buildnum
|
||||
|
||||
returns days since Apr 1 2015
|
||||
===============
|
||||
*/
|
||||
int Q_buildnum( void )
|
||||
int Q_buildnum_date( const char *date )
|
||||
{
|
||||
static int b = 0;
|
||||
int b;
|
||||
int m = 0;
|
||||
int d = 0;
|
||||
int y = 0;
|
||||
|
||||
if( b != 0 )
|
||||
return b;
|
||||
|
||||
for( m = 0; m < 11; m++ )
|
||||
{
|
||||
if( !Q_strnicmp( &date[0], mon[m], 3 ))
|
||||
@ -57,6 +46,23 @@ int Q_buildnum( void )
|
||||
return b;
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
Q_buildnum
|
||||
|
||||
returns days since Apr 1 2015
|
||||
===============
|
||||
*/
|
||||
int Q_buildnum( void )
|
||||
{
|
||||
static int b = 0;
|
||||
|
||||
if( !b )
|
||||
b = Q_buildnum_date( __DATE__ );
|
||||
|
||||
return b;
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
Q_buildnum_compat
|
||||
|
@ -48,6 +48,7 @@ enum
|
||||
// build.c
|
||||
//
|
||||
int Q_buildnum( void );
|
||||
int Q_buildnum_date( const char *date );
|
||||
int Q_buildnum_compat( void );
|
||||
const char *Q_PlatformStringByID( const int platform );
|
||||
const char *Q_buildos( void );
|
||||
|
Loading…
Reference in New Issue
Block a user