From 72eb98c75ee3f5d8ac87b2ffc3375ca1b329bf72 Mon Sep 17 00:00:00 2001 From: oy Date: Wed, 3 Aug 2011 23:17:26 +0200 Subject: changed to trunk again --- src/game/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/game/version.h') diff --git a/src/game/version.h b/src/game/version.h index 76b6d4ab..c7f04b75 100644 --- a/src/game/version.h +++ b/src/game/version.h @@ -3,6 +3,6 @@ #ifndef GAME_VERSION_H #define GAME_VERSION_H #include "generated/nethash.cpp" -#define GAME_VERSION "0.6.1" +#define GAME_VERSION "0.6 trunk" #define GAME_NETVERSION "0.6 " GAME_NETVERSION_HASH #endif -- cgit 1.4.1 From 590dbac239768d9ddb8712111b60c783431021d5 Mon Sep 17 00:00:00 2001 From: oy Date: Mon, 9 Jan 2012 02:02:02 +0100 Subject: put the game version constants all together in one file. Closes #870 --- src/engine/client/client.cpp | 19 ++++++++++++------- src/game/version.h | 1 + src/versionsrv/versionsrv.cpp | 6 ++++-- src/versionsrv/versionsrv.h | 2 -- 4 files changed, 17 insertions(+), 11 deletions(-) (limited to 'src/game/version.h') diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index 0e380e40..b115a9ac 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -36,6 +36,8 @@ #include #include +#include + #include #include @@ -859,23 +861,26 @@ void CClient::ProcessConnlessPacket(CNetChunk *pPacket) if(m_VersionInfo.m_State == CVersionInfo::STATE_READY && net_addr_comp(&pPacket->m_Address, &m_VersionInfo.m_VersionServeraddr.m_Addr) == 0) { // version info - if(pPacket->m_DataSize == (int)(sizeof(VERSIONSRV_VERSION) + sizeof(VERSION_DATA)) && + if(pPacket->m_DataSize == (int)(sizeof(VERSIONSRV_VERSION) + sizeof(GAME_RELEASE_VERSION)) && mem_comp(pPacket->m_pData, VERSIONSRV_VERSION, sizeof(VERSIONSRV_VERSION)) == 0) { - unsigned char *pVersionData = (unsigned char*)pPacket->m_pData + sizeof(VERSIONSRV_VERSION); - int VersionMatch = !mem_comp(pVersionData, VERSION_DATA, sizeof(VERSION_DATA)); + char *pVersionData = (char*)pPacket->m_pData + sizeof(VERSIONSRV_VERSION); + int VersionMatch = !mem_comp(pVersionData, GAME_RELEASE_VERSION, sizeof(GAME_RELEASE_VERSION)); + + char aVersion[sizeof(GAME_RELEASE_VERSION)]; + str_copy(aVersion, pVersionData, sizeof(aVersion)); char aBuf[256]; - str_format(aBuf, sizeof(aBuf), "version does %s (%d.%d.%d)", + str_format(aBuf, sizeof(aBuf), "version does %s (%s)", VersionMatch ? "match" : "NOT match", - pVersionData[1], pVersionData[2], pVersionData[3]); + aVersion); m_pConsole->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "client/version", aBuf); // assume version is out of date when version-data doesn't match - if (!VersionMatch) + if(!VersionMatch) { - str_format(m_aVersionStr, sizeof(m_aVersionStr), "%d.%d.%d", pVersionData[1], pVersionData[2], pVersionData[3]); + str_copy(m_aVersionStr, aVersion, sizeof(m_aVersionStr)); } // request the map version list now diff --git a/src/game/version.h b/src/game/version.h index c7f04b75..3d909e36 100644 --- a/src/game/version.h +++ b/src/game/version.h @@ -5,4 +5,5 @@ #include "generated/nethash.cpp" #define GAME_VERSION "0.6 trunk" #define GAME_NETVERSION "0.6 " GAME_NETVERSION_HASH +static const char GAME_RELEASE_VERSION[8] = {'0', '.', '6', '1', 0}; #endif diff --git a/src/versionsrv/versionsrv.cpp b/src/versionsrv/versionsrv.cpp index ac5883f9..da55e717 100644 --- a/src/versionsrv/versionsrv.cpp +++ b/src/versionsrv/versionsrv.cpp @@ -4,6 +4,8 @@ #include +#include + #include "versionsrv.h" enum { @@ -57,10 +59,10 @@ void BuildPackets() void SendVer(NETADDR *pAddr) { CNetChunk p; - unsigned char aData[sizeof(VERSIONSRV_VERSION) + sizeof(VERSION_DATA)]; + unsigned char aData[sizeof(VERSIONSRV_VERSION) + sizeof(GAME_RELEASE_VERSION)]; mem_copy(aData, VERSIONSRV_VERSION, sizeof(VERSIONSRV_VERSION)); - mem_copy(aData + sizeof(VERSIONSRV_VERSION), VERSION_DATA, sizeof(VERSION_DATA)); + mem_copy(aData + sizeof(VERSIONSRV_VERSION), GAME_RELEASE_VERSION, sizeof(GAME_RELEASE_VERSION)); p.m_ClientID = -1; p.m_Address = *pAddr; diff --git a/src/versionsrv/versionsrv.h b/src/versionsrv/versionsrv.h index 006a8e4d..383f1ac4 100644 --- a/src/versionsrv/versionsrv.h +++ b/src/versionsrv/versionsrv.h @@ -28,8 +28,6 @@ static CMapVersion s_aMapVersionList[] = { }; static const int s_NumMapVersionItems = sizeof(s_aMapVersionList)/sizeof(CMapVersion); -static const unsigned char VERSION_DATA[] = {0x00, 0, 6, 0}; - static const unsigned char VERSIONSRV_GETVERSION[] = {255, 255, 255, 255, 'v', 'e', 'r', 'g'}; static const unsigned char VERSIONSRV_VERSION[] = {255, 255, 255, 255, 'v', 'e', 'r', 's'}; -- cgit 1.4.1