Changed: Centralize version different formats

This commit is contained in:
kervala 2015-11-05 17:16:55 +01:00
parent dbb1e8b1a6
commit cbd227baa3
8 changed files with 60 additions and 41 deletions

View file

@ -49,9 +49,6 @@
#define FINAL_VERSION 1 #define FINAL_VERSION 1
#endif // TEST_CRASH_COUNTER #endif // TEST_CRASH_COUNTER
// game share
#include "game_share/ryzom_version.h"
// Client // Client
#include "resource.h" #include "resource.h"
#include "init.h" #include "init.h"

View file

@ -48,8 +48,6 @@
// Std. // Std.
#include <fstream> #include <fstream>
#include <sstream> #include <sstream>
// Game Share
#include "game_share/ryzom_version.h"
// Client // Client
#include "init.h" #include "init.h"
#include "input.h" #include "input.h"
@ -89,6 +87,7 @@
#include "interface_v3/add_on_manager.h" #include "interface_v3/add_on_manager.h"
#include "bg_downloader_access.h" #include "bg_downloader_access.h"
#include "user_agent.h"
#include "nel/misc/check_fpu.h" #include "nel/misc/check_fpu.h"
@ -837,11 +836,7 @@ void prelogInit()
displayCPUInfo(); displayCPUInfo();
// Display the client version. // Display the client version.
#if FINAL_VERSION nlinfo("RYZOM VERSION : %s", getDebugVersion().c_str());
nlinfo("RYZOM VERSION : FV %s ("__DATE__" "__TIME__")", RYZOM_VERSION);
#else
nlinfo("RYZOM VERSION : DEV %s ("__DATE__" "__TIME__")", RYZOM_VERSION);
#endif
FPU_CHECKER_ONCE FPU_CHECKER_ONCE

View file

@ -97,7 +97,6 @@
// Sound // Sound
#include "nel/sound/sound_anim_manager.h" #include "nel/sound/sound_anim_manager.h"
// Game share // Game share
#include "game_share/ryzom_version.h"
#include "game_share/light_cycle.h" #include "game_share/light_cycle.h"
#include "sound_manager.h" #include "sound_manager.h"
#include "precipitation_clip_grid.h" #include "precipitation_clip_grid.h"

View file

@ -50,7 +50,6 @@
#include "game_share/brick_types.h" #include "game_share/brick_types.h"
#include "game_share/light_cycle.h" #include "game_share/light_cycle.h"
#include "game_share/time_weather_season/time_and_season.h" #include "game_share/time_weather_season/time_and_season.h"
#include "game_share/ryzom_version.h"
#include "game_share/bot_chat_types.h" #include "game_share/bot_chat_types.h"
// PACS // PACS
#include "nel/pacs/u_global_position.h" #include "nel/pacs/u_global_position.h"

View file

@ -20,8 +20,6 @@
#include <nel/3d/u_text_context.h> #include <nel/3d/u_text_context.h>
#include <nel/gui/lua_ihm.h> #include <nel/gui/lua_ihm.h>
#include "game_share/ryzom_version.h"
#include "global.h" #include "global.h"
#include "client_cfg.h" #include "client_cfg.h"
#include "user_entity.h" #include "user_entity.h"
@ -44,7 +42,7 @@
#include "misc.h" #include "misc.h"
#include "interface_v3/interface_manager.h" #include "interface_v3/interface_manager.h"
#include "actions_client.h" #include "actions_client.h"
#include "user_agent.h"
using namespace NLMISC; using namespace NLMISC;
@ -244,15 +242,7 @@ void displayDebug()
//-----------// //-----------//
TextContext->setHotSpot(UTextContext::TopLeft); TextContext->setHotSpot(UTextContext::TopLeft);
line = 1.f; line = 1.f;
string str; string str = getDisplayVersion();
#if FINAL_VERSION
str = "FV";
#else
str = "DEV";
#endif
if(ClientCfg.ExtendedCommands)
str += "_E";
str += " "RYZOM_VERSION;
TextContext->printfAt(0.f, line, "Version %s", str.c_str()); TextContext->printfAt(0.f, line, "Version %s", str.c_str());
// TOP MIDDLE // // TOP MIDDLE //

View file

@ -21,7 +21,6 @@
#include "global.h" #include "global.h"
#include "nel/misc/events.h" #include "nel/misc/events.h"
#include "nel/3d/u_texture.h" #include "nel/3d/u_texture.h"
#include "game_share/ryzom_version.h"
#include "nel/misc/i18n.h" #include "nel/misc/i18n.h"
#include "continent.h" #include "continent.h"
#include "weather.h" #include "weather.h"
@ -31,6 +30,7 @@
#include "release.h" #include "release.h"
#include "net_manager.h" #include "net_manager.h"
#include "client_cfg.h" #include "client_cfg.h"
#include "user_agent.h"
#include "bg_downloader_access.h" #include "bg_downloader_access.h"
#include "nel/misc/system_utils.h" #include "nel/misc/system_utils.h"
#include "nel/3d/stereo_hmd.h" #include "nel/3d/stereo_hmd.h"
@ -277,13 +277,7 @@ void CProgress::internalProgress (float value)
// Display the build version. // Display the build version.
TextContext->setFontSize((uint)(12.f * fontFactor)); TextContext->setFontSize((uint)(12.f * fontFactor));
TextContext->setHotSpot(UTextContext::TopRight); TextContext->setHotSpot(UTextContext::TopRight);
string str; string str = getDisplayVersion();
#if FINAL_VERSION
str = "FV ";
#else
str = "DEV ";
#endif
str += RYZOM_VERSION;
TextContext->printfAt(1.0f,1.0f, str.c_str()); TextContext->printfAt(1.0f,1.0f, str.c_str());
// Display the tips of the day. // Display the tips of the day.

View file

@ -18,10 +18,11 @@
#include "stdpch.h" #include "stdpch.h"
#include "user_agent.h" #include "user_agent.h"
#include "client_cfg.h"
#include "game_share/ryzom_version.h" #include "game_share/ryzom_version.h"
#if defined(RYZOM_COMPATIBILITY_VERSION) && defined(HAVE_REVISION_H) #ifdef HAVE_REVISION_H
#include "revision.h" #include "revision.h"
#endif #endif
@ -60,17 +61,57 @@ std::string getUserAgentVersion()
if (s_userAgent.empty()) if (s_userAgent.empty())
{ {
char buffer[256]; #ifdef REVISION
s_userAgent = NLMISC::toString("%s.%s-%s-%s", RYZOM_VERSION, REVISION, RYZOM_SYSTEM, RYZOM_ARCH);
#if defined(REVISION) && defined(RYZOM_COMPATIBILITY_VERSION)
// we don't need RYZOM_VERSION if we already have a numeric form a.b.c, we just need to append revision to it
sprintf(buffer, "%s.%s-%s-%s", RYZOM_COMPATIBILITY_VERSION, REVISION, RYZOM_SYSTEM, RYZOM_ARCH);
#else #else
sprintf(buffer, "%s-%s-%s", RYZOM_VERSION, RYZOM_SYSTEM, RYZOM_ARCH); s_userAgent = NLMISC::toString("%s-%s-%s", RYZOM_VERSION, RYZOM_SYSTEM, RYZOM_ARCH);
#endif #endif
s_userAgent = buffer;
} }
return s_userAgent; return s_userAgent;
} }
std::string getVersion()
{
return RYZOM_VERSION;
}
std::string getDisplayVersion()
{
static std::string s_version;
if (s_version.empty())
{
#if FINAL_VERSION
s_version = "FV ";
#else
s_version = "DEV ";
#endif
if (ClientCfg.ExtendedCommands) s_version += "_E";
s_version += getVersion();
#ifdef REVISION
s_version += NLMISC::toString(".%s", REVISION);
#endif
}
return s_version;
}
std::string getDebugVersion()
{
static std::string s_version;
if (s_version.empty())
{
s_version = getDisplayVersion();
#ifdef BUILD_DATE
s_version += NLMISC::toString(" (%s)", BUILD_DATE);
#else
s_version += NLMISC::toString(" (%s %s)", __DATE__, __TIME__);
#endif
}
return s_version;
}

View file

@ -21,6 +21,10 @@ std::string getUserAgent();
std::string getUserAgentName(); std::string getUserAgentName();
std::string getUserAgentVersion(); std::string getUserAgentVersion();
std::string getVersion();
std::string getDisplayVersion();
std::string getDebugVersion();
#endif // CL_USER_AGENT_H #endif // CL_USER_AGENT_H
/* End of user_agent.h */ /* End of user_agent.h */