Added git revision to several places

This commit is contained in:
GreYFoX 2011-03-18 01:21:07 +02:00
parent 45f3cf042a
commit 974f429957
4 changed files with 18 additions and 1 deletions

View file

@ -1,4 +1,4 @@
import hashlib, sys, re
import hashlib, sys, re, os
alphanum = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_".encode()
@ -34,3 +34,4 @@ hash = hashlib.md5(f).hexdigest().lower()[16:]
if hash == "8755162e69711f98":
hash = "b67d1f1a1eea234e"
print('#define GAME_NETVERSION_HASH "%s"' % hash)
print('#define GIT_SHORTREV_HASH "%s"' % os.popen('git rev-parse HEAD').readline(8))

View file

@ -28,6 +28,7 @@
#include <game/client/components/menus.h>
#include "console.h"
#include <game/generated/nethash.c>
enum
{
@ -434,7 +435,12 @@ void CGameConsole::OnRender()
// render version
char aBuf[128];
#if defined( GIT_SHORTREV_HASH )
dbg_msg("GIT Hash", GIT_SHORTREV_HASH);
str_format(aBuf, sizeof(aBuf), "v%s %s", GAME_VERSION, GIT_SHORTREV_HASH);
#else
str_format(aBuf, sizeof(aBuf), "v%s", GAME_VERSION);
#endif
float VersionWidth = TextRender()->TextWidth(0, FontSize, aBuf, -1);
TextRender()->Text(0, Screen.w-VersionWidth-5, y, FontSize, aBuf, -1);

View file

@ -12,6 +12,7 @@
#include "menus.h"
#include <game/localization.h>
#include <game/version.h>
#include <game/generated/nethash.c>
void CMenus::RenderServerbrowserServerList(CUIRect View)
{
@ -910,6 +911,11 @@ void CMenus::RenderServerbrowser(CUIRect MainView)
if(str_comp(Client()->LatestVersion(), "0") != 0)
str_format(aBuf, sizeof(aBuf), Localize("Teeworlds %s is out! Download it at www.teeworlds.com!"), Client()->LatestVersion());
else
#if defined( GIT_SHORTREV_HASH )
str_format(aBuf, sizeof(aBuf), Localize("Current version: v.%s g.%s"), GAME_VERSION, GIT_SHORTREV_HASH);
#else
str_format(aBuf, sizeof(aBuf), Localize("Current version: %s"), GAME_VERSION);
#endif
str_format(aBuf, sizeof(aBuf), Localize("Current version: %s"), GAME_VERSION);
UI()->DoLabelScaled(&StatusToolBox, aBuf, 14.0f, -1);
}

View file

@ -5,6 +5,7 @@
#include <game/server/teams.h>
#include <game/server/gamemodes/DDRace.h>
#include <game/version.h>
#include <game/generated/nethash.c>
#if defined(CONF_SQL)
#include <game/server/score/sql_score.h>
#endif
@ -508,6 +509,9 @@ void CGameContext::ConInfo(IConsole::IResult *pResult, void *pUserData, int Clie
CGameContext *pSelf = (CGameContext *)pUserData;
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", "DDRace Mod. Version: " GAME_VERSION);
#if defined( GIT_SHORTREV_HASH )
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", "Git revision hash: " GIT_SHORTREV_HASH);
#endif
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", "Official site: DDRace.info");
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", "For more Info /cmdlist");
pSelf->Console()->PrintResponse(IConsole::OUTPUT_LEVEL_STANDARD, "info", "Or visit DDRace.info");