Merge pull request #7153 from infclass/for-ddnet4

Mod Support: CMake: Use DDNet_VERSION to construct DDNET_VERSION_NUMBER
This commit is contained in:
Dennis Felsing 2023-09-08 22:10:52 +00:00 committed by GitHub
commit b951eab257
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 12 additions and 12 deletions

View file

@ -142,16 +142,16 @@ if(IPO)
endif()
endif()
if("0${PROJECT_VERSION_PATCH}" GREATER 9)
message(SEND_ERROR "Invalid project patch version (the version is \"${PROJECT_VERSION}\", the patch part must be in range 0-9 if set)")
if("0${DDNet_VERSION_PATCH}" GREATER 9)
message(SEND_ERROR "Invalid DDNet patch version (the version is \"${DDNet_VERSION}\", the patch part must be in range 0-9 if set)")
endif()
if(${PROJECT_VERSION_MINOR} GREATER 99)
message(SEND_ERROR "Invalid project minor version (the version is \"${PROJECT_VERSION}\", the minor part must be in range 0-99)")
if(${DDNet_VERSION_MINOR} GREATER 99)
message(SEND_ERROR "Invalid DDNet minor version (the version is \"${DDNet_VERSION}\", the minor part must be in range 0-99)")
endif()
if(${PROJECT_VERSION_MINOR} GREATER 9)
set(CLIENT_VERSIONNR ${PROJECT_VERSION_MAJOR}${PROJECT_VERSION_MINOR}${PROJECT_VERSION_PATCH})
if(${DDNet_VERSION_MINOR} GREATER 9)
set(DDNET_VERSION_NUMBER ${DDNet_VERSION_MAJOR}${DDNet_VERSION_MINOR}${DDNet_VERSION_PATCH})
else()
set(CLIENT_VERSIONNR ${PROJECT_VERSION_MAJOR}0${PROJECT_VERSION_MINOR}${PROJECT_VERSION_PATCH})
set(DDNET_VERSION_NUMBER ${DDNet_VERSION_MAJOR}0${DDNet_VERSION_MINOR}${DDNet_VERSION_PATCH})
endif()
configure_file(src/game/version.h.in ${PROJECT_BINARY_DIR}/src/game/version.h)
@ -2893,7 +2893,7 @@ set(CPACK_SOURCE_GENERATOR ZIP TGZ TBZ2 TXZ)
set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH})
set(CPACK_PACKAGE_VERSION ${VERSION})
set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
set(CPACK_SYSTEM_NAME ${CMAKE_SYSTEM_NAME})
if(TARGET_OS AND TARGET_BITS)

View file

@ -762,7 +762,7 @@ int CServer::GetClientVersion(int ClientID) const
{
// Assume latest client version for server demos
if(ClientID == SERVER_DEMO_CLIENT)
return CLIENT_VERSIONNR;
return DDNET_VERSION_NUMBER;
CClientInfo Info;
if(GetClientInfo(ClientID, &Info))

View file

@ -76,7 +76,7 @@ using namespace std::chrono_literals;
const char *CGameClient::Version() const { return GAME_VERSION; }
const char *CGameClient::NetVersion() const { return GAME_NETVERSION; }
int CGameClient::DDNetVersion() const { return CLIENT_VERSIONNR; }
int CGameClient::DDNetVersion() const { return DDNET_VERSION_NUMBER; }
const char *CGameClient::DDNetVersionStr() const { return m_aDDNetVersionStr; }
const char *CGameClient::GetItemName(int Type) const { return m_NetObjHandler.GetObjName(Type); }
@ -1770,7 +1770,7 @@ void CGameClient::OnNewSnapshot()
continue;
}
CMsgPacker Msg(NETMSGTYPE_CL_ISDDNETLEGACY, false);
Msg.AddInt(CLIENT_VERSIONNR);
Msg.AddInt(DDNetVersion());
Client()->SendMsg(i, &Msg, MSGFLAG_VITAL);
m_aDDRaceMsgSent[i] = true;
}

View file

@ -6,7 +6,7 @@
#define GAME_RELEASE_VERSION "${PROJECT_VERSION}"
#define GAME_VERSION "0.6.4, " GAME_RELEASE_VERSION
#define GAME_NETVERSION "0.6 626fce9a778df4d4"
#define CLIENT_VERSIONNR ${CLIENT_VERSIONNR}
#define DDNET_VERSION_NUMBER ${DDNET_VERSION_NUMBER}
extern const char *GIT_SHORTREV_HASH;
#define GAME_NAME "DDNet"
#endif