Change the VERSION number from float to string

Using a float number as version number is a bad idea. Correct this long
standing problem by changing it to a string. If we ever want to compare
version numbers, 2 integer constants "MAJOR_VERSION" and "MINOR_VERSION"
should be added.
This commit is contained in:
Yamagi Burmeister 2012-07-27 08:57:52 +02:00
parent b52336850f
commit 3918d3ba34
8 changed files with 11 additions and 9 deletions

View file

@ -624,7 +624,7 @@ Con_DrawConsole(float frac)
SCR_AddDirtyPoint(0, 0);
SCR_AddDirtyPoint(viddef.width - 1, lines - 1);
Com_sprintf(version, sizeof(version), "Yamagi Quake II v%4.2f", VERSION);
Com_sprintf(version, sizeof(version), "Yamagi Quake II v%s", VERSION);
for (x = 0; x < 21; x++)
{

View file

@ -32,7 +32,9 @@
#include "shared.h"
#include "crc.h"
#define VERSION 4.90
/* Should have 4 characters. */
#define VERSION "4.90"
#define BASEDIRNAME "baseq2"
#if defined __linux__

View file

@ -241,7 +241,7 @@ Qcommon_Init(int argc, char **argv)
dedicated = Cvar_Get("dedicated", "0", CVAR_NOSET);
#endif
s = va("%4.2f %s %s %s", VERSION, CPUSTRING, __DATE__, BUILDSTRING);
s = va("%s %s %s %s", VERSION, CPUSTRING, __DATE__, BUILDSTRING);
Cvar_Get("version", s, CVAR_SERVERINFO | CVAR_NOSET);
if (dedicated->value)

View file

@ -292,7 +292,7 @@ GLimp_InitGraphics(qboolean fullscreen)
#endif
/* Window title */
snprintf(title, sizeof(title), "Yamagi Quake II %4.2f", VERSION);
snprintf(title, sizeof(title), "Yamagi Quake II %s", VERSION);
SDL_WM_SetCaption(title, title);
/* No cursor */

View file

@ -172,7 +172,7 @@ SVC_DirectConnect(void)
if (version != PROTOCOL_VERSION)
{
Netchan_OutOfBandPrint(NS_SERVER, adr,
"print\nServer is version %4.2f.\n", VERSION);
"print\nServer is version %s.\n", VERSION);
Com_DPrintf(" rejected connect from version %i\n", version);
return;
}

View file

@ -68,7 +68,7 @@ main(int argc, char **argv)
/* enforce C locale */
setenv("LC_ALL", "C", 1);
printf("\nYamagi Quake II v%4.2f\n", VERSION);
printf("\nYamagi Quake II v%s\n", VERSION);
printf("=====================\n\n");
#ifndef DEDICATED_ONLY

View file

@ -47,7 +47,7 @@ printBacktrace(int sig)
strings = backtrace_symbols(array, size);
printf("Product: Yamagi Quake II\n");
printf("Version: %4.2f\n", VERSION);
printf("Version: %s\n", VERSION);
printf("Plattform: %s\n", BUILDSTRING);
printf("Architecture: %s\n", CPUSTRING);
printf("Compiler: %s\n", __VERSION__);
@ -68,7 +68,7 @@ void
printBacktrace(int sig)
{
printf("Product: Yamagi Quake II\n");
printf("Version: %4.2f\n", VERSION);
printf("Version: %s\n", VERSION);
printf("Plattform: %s\n", BUILDSTRING);
printf("Architecture: %s\n", CPUSTRING);
printf("Compiler: %s\n", __VERSION__);

View file

@ -711,7 +711,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
Sys_RedirectStdout();
#endif
printf("Yamagi Quake II v%4.2f\n", VERSION);
printf("Yamagi Quake II v%s\n", VERSION);
printf("=====================\n\n");
#ifndef DEDICATED_ONLY