- changed to git version stamp
This commit is contained in:
parent
1a8673feb3
commit
f217db38f1
|
@ -24,28 +24,6 @@ IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||||
ADD_DEFINITIONS("-Qunused-arguments -Wno-switch")
|
ADD_DEFINITIONS("-Qunused-arguments -Wno-switch")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
FUNCTION(Subversion_IS_WC FOLDER RESULT_VAR)
|
|
||||||
IF(Subversion_FOUND)
|
|
||||||
|
|
||||||
# SVN info does not like .. as paths, so be sure that we use a full path
|
|
||||||
GET_FILENAME_COMPONENT(ABS_FOLDER ${FOLDER} ABSOLUTE)
|
|
||||||
EXECUTE_PROCESS(COMMAND ${Subversion_SVN_EXECUTABLE} info ${ABS_FOLDER}
|
|
||||||
RESULT_VARIABLE INFO_RESULT
|
|
||||||
OUTPUT_VARIABLE IGNORED
|
|
||||||
ERROR_VARIABLE IGNORED)
|
|
||||||
IF(INFO_RESULT EQUAL 0)
|
|
||||||
SET(${RESULT_VAR} TRUE PARENT_SCOPE)
|
|
||||||
ELSE()
|
|
||||||
SET(${RESULT_VAR} FALSE PARENT_SCOPE)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
ELSE()
|
|
||||||
MESSAGE(STATUS "Cannot check whether folder ${FOLDER} is a svn working copy because svn was not found. Returning FALSE.")
|
|
||||||
SET(${RESULT_VAR} FALSE PARENT_SCOPE)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
ENDFUNCTION()
|
|
||||||
|
|
||||||
OPTION(BUILD_MEGAGLEST_MODEL_IMPORT_EXPORT_TOOLS "Build model import/export tools" ON)
|
OPTION(BUILD_MEGAGLEST_MODEL_IMPORT_EXPORT_TOOLS "Build model import/export tools" ON)
|
||||||
OPTION(BUILD_MEGAGLEST_MODEL_VIEWER "Build model viewer" ON)
|
OPTION(BUILD_MEGAGLEST_MODEL_VIEWER "Build model viewer" ON)
|
||||||
OPTION(BUILD_MEGAGLEST_MAP_EDITOR "Build map editor" ON)
|
OPTION(BUILD_MEGAGLEST_MAP_EDITOR "Build map editor" ON)
|
||||||
|
@ -207,30 +185,42 @@ IF(CMAKE_COMPILER_IS_GNUCXX OR MINGW)
|
||||||
SET(CMAKE_CXX_FLAGS_MINSIZEREL "-O3 ${CMAKE_CXX_FLAGS_MINSIZEREL} -O3 ")
|
SET(CMAKE_CXX_FLAGS_MINSIZEREL "-O3 ${CMAKE_CXX_FLAGS_MINSIZEREL} -O3 ")
|
||||||
SET(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL} -s") ## Strip binary
|
SET(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL} -s") ## Strip binary
|
||||||
|
|
||||||
SET(HAS_SVN "FALSE")
|
# Get the git revision info for the binary
|
||||||
|
SET(HAS_GIT "FALSE")
|
||||||
|
|
||||||
OPTION(WANT_SVN_STAMP "use svn stamp" ON)
|
OPTION(WANT_GIT_STAMP "use git revision stamp" ON)
|
||||||
IF(WANT_SVN_STAMP)
|
IF(WANT_GIT_STAMP)
|
||||||
# The stuff below gets SVN Global Revision # but ONLY when calling cmake!
|
# The stuff below gets GIT Global Revision # but ONLY when calling cmake!
|
||||||
# the FindSubversion.cmake module is part of the standard distribution
|
# the FindGit.cmake module is part of the standard distribution
|
||||||
include(FindSubversion)
|
include(FindGit)
|
||||||
|
|
||||||
|
IF(GIT_FOUND)
|
||||||
|
SET(HAS_GIT "TRUE")
|
||||||
|
MESSAGE(STATUS "Found GIT and using GIT version stamping...")
|
||||||
|
|
||||||
|
# Get the current commit SHA1
|
||||||
|
execute_process(
|
||||||
|
COMMAND git log -1 --format=%h
|
||||||
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||||
|
OUTPUT_VARIABLE GIT_SHA1
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
|
||||||
|
# Get the current version counter
|
||||||
|
execute_process(
|
||||||
|
COMMAND git rev-list HEAD --count
|
||||||
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||||
|
OUTPUT_VARIABLE GIT_COMMIT_COUNT
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
|
||||||
|
MESSAGE(STATUS "Using GIT revision stamp: [${GIT_COMMIT_COUNT}.${GIT_SHA1}]")
|
||||||
|
|
||||||
Subversion_IS_WC(${PROJECT_SOURCE_DIR} HAS_SVN)
|
|
||||||
IF(${HAS_SVN} STREQUAL "TRUE")
|
|
||||||
MESSAGE(STATUS "Found SVN and using SVN version stamping...")
|
|
||||||
# extract working copy information for SOURCE_DIR into MY_XXX variables
|
|
||||||
Subversion_WC_INFO(${PROJECT_SOURCE_DIR} MG)
|
|
||||||
#add_definitions(-DSVNVERSION="${MG_WC_REVISION}")
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
SET(SVN_VERSION_CMD "-DSVNVERSION='\\\"${MG_WC_REVISION}\\\"'")
|
SET(GIT_VERSION_CMD "-DGITVERSION='\\\"${GIT_COMMIT_COUNT}.${GIT_SHA1}\\\"'")
|
||||||
|
|
||||||
IF(UNIX AND NOT APPLE AND ${HAS_SVN} STREQUAL "TRUE")
|
|
||||||
# We do some funky character escaping to get the right stuff written out to
|
|
||||||
# the final Makefile so we get the SVN Global Revsion #
|
|
||||||
SET(SVN_VERSION_CMD "-DSVNVERSION='\\\"`svnversion -n ${PROJECT_SOURCE_DIR}`\\\"'")
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
IF(CMAKE_INSTALL_PREFIX STREQUAL "")
|
IF(CMAKE_INSTALL_PREFIX STREQUAL "")
|
||||||
MESSAGE(STATUS "*NOTE: NOT USING a Custom Data Install Path...")
|
MESSAGE(STATUS "*NOTE: NOT USING a Custom Data Install Path...")
|
||||||
|
@ -262,13 +252,13 @@ IF(CMAKE_COMPILER_IS_GNUCXX OR MINGW)
|
||||||
MESSAGE(STATUS "*NOTE: Custom Data Install Path is [${CUSTOM_DATA_INSTALL_PATH}]")
|
MESSAGE(STATUS "*NOTE: Custom Data Install Path is [${CUSTOM_DATA_INSTALL_PATH}]")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${SVN_VERSION_CMD} ${CUSTOM_DATA_INSTALL_PATH_VALUE}")
|
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${GIT_VERSION_CMD} ${CUSTOM_DATA_INSTALL_PATH_VALUE}")
|
||||||
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${SVN_VERSION_CMD} ${CUSTOM_DATA_INSTALL_PATH_VALUE}")
|
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${GIT_VERSION_CMD} ${CUSTOM_DATA_INSTALL_PATH_VALUE}")
|
||||||
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${SVN_VERSION_CMD} ${CUSTOM_DATA_INSTALL_PATH_VALUE}")
|
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} ${GIT_VERSION_CMD} ${CUSTOM_DATA_INSTALL_PATH_VALUE}")
|
||||||
SET(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} ${SVN_VERSION_CMD} ${CUSTOM_DATA_INSTALL_PATH_VALUE}")
|
SET(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} ${GIT_VERSION_CMD} ${CUSTOM_DATA_INSTALL_PATH_VALUE}")
|
||||||
|
|
||||||
# We do some funky character escaping to get the right stuff written out to
|
# We do some funky character escaping to get the right stuff written out to
|
||||||
# the final Makefile so we get the SVN Global Revsion #
|
# the final Makefile so we get the GIT Global Revsion #
|
||||||
string(REPLACE "'" "\"" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
|
string(REPLACE "'" "\"" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
|
||||||
string(REPLACE "'" "\"" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
|
string(REPLACE "'" "\"" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
|
||||||
string(REPLACE "'" "\"" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
|
string(REPLACE "'" "\"" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
|
||||||
|
|
|
@ -297,9 +297,9 @@ IF(BUILD_MEGAGLEST)
|
||||||
DESTINATION ${MEGAGLEST_MANPAGE_INSTALL_PATH})
|
DESTINATION ${MEGAGLEST_MANPAGE_INSTALL_PATH})
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
# Check if we are running from an SVN folder structure or tarballs
|
# Check if we are running from an GIT folder structure or tarballs
|
||||||
IF(EXISTS "${PROJECT_SOURCE_DIR}/mk/linux/megaglest.desktop")
|
IF(EXISTS "${PROJECT_SOURCE_DIR}/mk/linux/megaglest.desktop")
|
||||||
MESSAGE(STATUS "**Source package detected svn folder structure.")
|
MESSAGE(STATUS "**Source package detected git folder structure.")
|
||||||
|
|
||||||
# Installation of the program desktop file
|
# Installation of the program desktop file
|
||||||
INSTALL(FILES
|
INSTALL(FILES
|
||||||
|
|
|
@ -28,20 +28,20 @@ namespace Glest { namespace Game {
|
||||||
|
|
||||||
const char *mailString = " http://bugs.megaglest.org";
|
const char *mailString = " http://bugs.megaglest.org";
|
||||||
const string glestVersionString = "v3.9.0";
|
const string glestVersionString = "v3.9.0";
|
||||||
#if defined(SVNVERSION)
|
#if defined(GITVERSION)
|
||||||
const string SVN_RawRev = string(SVNVERSION);
|
const string GIT_RawRev = string(GITVERSION);
|
||||||
const string SVN_Rev = string("Rev: ") + string(SVNVERSION);
|
const string GIT_Rev = string("Rev: ") + string(GITVERSION);
|
||||||
#elif defined(SVNVERSIONHEADER)
|
#elif defined(GITVERSIONHEADER)
|
||||||
#include "svnversion.h"
|
#include "gitversion.h"
|
||||||
const string SVN_RawRev = string(SVNVERSION);
|
const string GIT_RawRev = string(GITVERSION);
|
||||||
const string SVN_Rev = string("Rev: ") + string(SVNVERSION);
|
const string GIT_Rev = string("Rev: ") + string(GITVERSION);
|
||||||
#else
|
#else
|
||||||
const string SVN_RawRev = "$4790$";
|
const string GIT_RawRev = "$4790$";
|
||||||
const string SVN_Rev = "$Rev$";
|
const string GIT_Rev = "$Rev$";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
string getRAWSVNRevisionString() {
|
string getRAWGITRevisionString() {
|
||||||
return SVN_RawRev;
|
return GIT_RawRev;
|
||||||
}
|
}
|
||||||
string getCrashDumpFileName(){
|
string getCrashDumpFileName(){
|
||||||
return "megaglest" + glestVersionString + ".dmp";
|
return "megaglest" + glestVersionString + ".dmp";
|
||||||
|
@ -110,8 +110,8 @@ string getPlatformNameString() {
|
||||||
return platform;
|
return platform;
|
||||||
}
|
}
|
||||||
|
|
||||||
string getSVNRevisionString() {
|
string getGITRevisionString() {
|
||||||
return SVN_Rev;
|
return GIT_Rev;
|
||||||
}
|
}
|
||||||
|
|
||||||
string getCompilerNameString() {
|
string getCompilerNameString() {
|
||||||
|
@ -162,10 +162,10 @@ string getNetworkVersionString() {
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
string getNetworkVersionSVNString() {
|
string getNetworkVersionGITString() {
|
||||||
static string version = "";
|
static string version = "";
|
||||||
if(version == "") {
|
if(version == "") {
|
||||||
version = glestVersionString + "-" + getCompilerNameString() + "-" + getSVNRevisionString();
|
version = glestVersionString + "-" + getCompilerNameString() + "-" + getGITRevisionString();
|
||||||
}
|
}
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,7 @@ string getNetworkPlatformFreeVersionString() {
|
||||||
string getAboutString1(int i) {
|
string getAboutString1(int i) {
|
||||||
switch(i) {
|
switch(i) {
|
||||||
case 0: return "MegaGlest " + glestVersionString + " (" + "Shared Library " + sharedLibVersionString + ")";
|
case 0: return "MegaGlest " + glestVersionString + " (" + "Shared Library " + sharedLibVersionString + ")";
|
||||||
case 1: return "Built: " + string(__DATE__) + " " + SVN_Rev;
|
case 1: return "Built: " + string(__DATE__) + " " + GIT_Rev;
|
||||||
case 2: return "Copyright 2001-2012 The MegaGlest Team";
|
case 2: return "Copyright 2001-2012 The MegaGlest Team";
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
|
@ -333,10 +333,10 @@ string getGameReadWritePath(string lookupKey) {
|
||||||
void initSpecialStrings() {
|
void initSpecialStrings() {
|
||||||
getCrashDumpFileName();
|
getCrashDumpFileName();
|
||||||
getPlatformNameString();
|
getPlatformNameString();
|
||||||
getSVNRevisionString();
|
getGITRevisionString();
|
||||||
getCompilerNameString();
|
getCompilerNameString();
|
||||||
getNetworkVersionString();
|
getNetworkVersionString();
|
||||||
getNetworkVersionSVNString();
|
getNetworkVersionGITString();
|
||||||
getNetworkPlatformFreeVersionString();
|
getNetworkPlatformFreeVersionString();
|
||||||
getCompileDateTime();
|
getCompileDateTime();
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,11 +34,11 @@ extern const string networkVersionString;
|
||||||
void initSpecialStrings();
|
void initSpecialStrings();
|
||||||
string getCrashDumpFileName();
|
string getCrashDumpFileName();
|
||||||
string getPlatformNameString();
|
string getPlatformNameString();
|
||||||
string getSVNRevisionString();
|
string getGITRevisionString();
|
||||||
string getRAWSVNRevisionString();
|
string getRAWGITRevisionString();
|
||||||
string getCompilerNameString();
|
string getCompilerNameString();
|
||||||
string getNetworkVersionString();
|
string getNetworkVersionString();
|
||||||
string getNetworkVersionSVNString();
|
string getNetworkVersionGITString();
|
||||||
string getNetworkPlatformFreeVersionString();
|
string getNetworkPlatformFreeVersionString();
|
||||||
string getAboutString1(int i);
|
string getAboutString1(int i);
|
||||||
string getAboutString2(int i);
|
string getAboutString2(int i);
|
||||||
|
|
|
@ -5037,7 +5037,7 @@ void Game::DumpCRCWorldLogIfRequired(string fileSuffix) {
|
||||||
#endif
|
#endif
|
||||||
logFile << "World CRC debug information:" << std::endl;
|
logFile << "World CRC debug information:" << std::endl;
|
||||||
logFile << "============================" << std::endl;
|
logFile << "============================" << std::endl;
|
||||||
logFile << "Software version: " << glestVersionString << "-" << getCompilerNameString() << "-" << getSVNRevisionString() << std::endl;
|
logFile << "Software version: " << glestVersionString << "-" << getCompilerNameString() << "-" << getGITRevisionString() << std::endl;
|
||||||
logFile << "Maximum framecount: " << world.getFaction(0)->getCRC_DetailsForWorldFrameCount() << std::endl;
|
logFile << "Maximum framecount: " << world.getFaction(0)->getCRC_DetailsForWorldFrameCount() << std::endl;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4099,7 +4099,7 @@ int glestMain(int argc, char** argv) {
|
||||||
printf("\nSwitchSetupRequest sizeof = " MG_SIZE_T_SPECIFIER "",SwitchSetupRequest().getDataSize());
|
printf("\nSwitchSetupRequest sizeof = " MG_SIZE_T_SPECIFIER "",SwitchSetupRequest().getDataSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("\nSVN: [%s]",getSVNRevisionString().c_str());
|
printf("\nGIT: [%s]",getGITRevisionString().c_str());
|
||||||
|
|
||||||
#ifdef USE_STREFLOP
|
#ifdef USE_STREFLOP
|
||||||
|
|
||||||
|
@ -4124,7 +4124,7 @@ int glestMain(int argc, char** argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
setGameVersion(glestVersionString);
|
setGameVersion(glestVersionString);
|
||||||
setGameSVNVersion(getRAWSVNRevisionString());
|
setGameGITVersion(getRAWGITRevisionString());
|
||||||
|
|
||||||
if( hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_OPENGL_INFO]) == true ||
|
if( hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_OPENGL_INFO]) == true ||
|
||||||
hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_SDL_INFO]) == true ||
|
hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_SDL_INFO]) == true ||
|
||||||
|
|
|
@ -222,7 +222,7 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu,
|
||||||
labelLocalGameVersion.setText(glestVersionString);
|
labelLocalGameVersion.setText(glestVersionString);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
labelLocalGameVersion.setText(glestVersionString + " [" + getCompileDateTime() + ", " + getSVNRevisionString() + "]");
|
labelLocalGameVersion.setText(glestVersionString + " [" + getCompileDateTime() + ", " + getGITRevisionString() + "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
xoffset=70;
|
xoffset=70;
|
||||||
|
@ -707,7 +707,7 @@ void MenuStateCustomGame::reloadUI() {
|
||||||
labelLocalGameVersion.setText(glestVersionString);
|
labelLocalGameVersion.setText(glestVersionString);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
labelLocalGameVersion.setText(glestVersionString + " [" + getCompileDateTime() + ", " + getSVNRevisionString() + "]");
|
labelLocalGameVersion.setText(glestVersionString + " [" + getCompileDateTime() + ", " + getGITRevisionString() + "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
//vector<string> teamItems, controlItems, results , rMultiplier;
|
//vector<string> teamItems, controlItems, results , rMultiplier;
|
||||||
|
@ -2970,7 +2970,7 @@ void MenuStateCustomGame::publishToMasterserver() {
|
||||||
|
|
||||||
//?status=waiting&system=linux&info=titus
|
//?status=waiting&system=linux&info=titus
|
||||||
publishToServerInfo["glestVersion"] = glestVersionString;
|
publishToServerInfo["glestVersion"] = glestVersionString;
|
||||||
publishToServerInfo["platform"] = getPlatformNameString() + "-" + getSVNRevisionString();
|
publishToServerInfo["platform"] = getPlatformNameString() + "-" + getGITRevisionString();
|
||||||
publishToServerInfo["binaryCompileDate"] = getCompileDateTime();
|
publishToServerInfo["binaryCompileDate"] = getCompileDateTime();
|
||||||
|
|
||||||
//game info:
|
//game info:
|
||||||
|
|
|
@ -49,7 +49,7 @@ MenuStateRoot::MenuStateRoot(Program *program, MainMenu *mainMenu):
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
labelVersion.init(405, yPos);
|
labelVersion.init(405, yPos);
|
||||||
labelVersion.setText(glestVersionString + " [" + getCompileDateTime() + ", " + getSVNRevisionString() + "]");
|
labelVersion.setText(glestVersionString + " [" + getCompileDateTime() + ", " + getGITRevisionString() + "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
yPos-=55;
|
yPos-=55;
|
||||||
|
@ -110,7 +110,7 @@ void MenuStateRoot::reloadUI() {
|
||||||
labelVersion.setText(glestVersionString);
|
labelVersion.setText(glestVersionString);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
labelVersion.setText(glestVersionString + " [" + getCompileDateTime() + ", " + getSVNRevisionString() + "]");
|
labelVersion.setText(glestVersionString + " [" + getCompileDateTime() + ", " + getGITRevisionString() + "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
buttonNewGame.setText(lang.getString("NewGame"));
|
buttonNewGame.setText(lang.getString("NewGame"));
|
||||||
|
|
|
@ -553,7 +553,7 @@ void ClientInterface::updateLobby() {
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] got NetworkMessageIntro, networkMessageIntro.getGameState() = %d, versionString [%s], sessionKey = %d, playerIndex = %d, serverFTPPort = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageIntro.getGameState(),versionString.c_str(),sessionKey,playerIndex,serverFTPPort);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] got NetworkMessageIntro, networkMessageIntro.getGameState() = %d, versionString [%s], sessionKey = %d, playerIndex = %d, serverFTPPort = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageIntro.getGameState(),versionString.c_str(),sessionKey,playerIndex,serverFTPPort);
|
||||||
|
|
||||||
//check consistency
|
//check consistency
|
||||||
bool compatible = checkVersionComptability(networkMessageIntro.getVersionString(), getNetworkVersionSVNString());
|
bool compatible = checkVersionComptability(networkMessageIntro.getVersionString(), getNetworkVersionGITString());
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] got NetworkMessageIntro, networkMessageIntro.getGameState() = %d, versionString [%s], sessionKey = %d, playerIndex = %d, serverFTPPort = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageIntro.getGameState(),versionString.c_str(),sessionKey,playerIndex,serverFTPPort);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] got NetworkMessageIntro, networkMessageIntro.getGameState() = %d, versionString [%s], sessionKey = %d, playerIndex = %d, serverFTPPort = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,networkMessageIntro.getGameState(),versionString.c_str(),sessionKey,playerIndex,serverFTPPort);
|
||||||
|
|
||||||
|
@ -568,12 +568,12 @@ void ClientInterface::updateLobby() {
|
||||||
if(strncmp(platformFreeVersion.c_str(),networkMessageIntro.getVersionString().c_str(),strlen(platformFreeVersion.c_str())) != 0) {
|
if(strncmp(platformFreeVersion.c_str(),networkMessageIntro.getVersionString().c_str(),strlen(platformFreeVersion.c_str())) != 0) {
|
||||||
string playerNameStr = getHumanPlayerName();
|
string playerNameStr = getHumanPlayerName();
|
||||||
sErr = "Server and client binary mismatch!\nYou have to use the exactly same binaries!\n\nServer: " + networkMessageIntro.getVersionString() +
|
sErr = "Server and client binary mismatch!\nYou have to use the exactly same binaries!\n\nServer: " + networkMessageIntro.getVersionString() +
|
||||||
"\nClient: " + getNetworkVersionSVNString() + " player [" + playerNameStr + "]";
|
"\nClient: " + getNetworkVersionGITString() + " player [" + playerNameStr + "]";
|
||||||
printf("%s\n",sErr.c_str());
|
printf("%s\n",sErr.c_str());
|
||||||
|
|
||||||
sendTextMessage("Server and client binary mismatch!!",-1, true,"");
|
sendTextMessage("Server and client binary mismatch!!",-1, true,"");
|
||||||
sendTextMessage(" Server:" + networkMessageIntro.getVersionString(),-1, true,"");
|
sendTextMessage(" Server:" + networkMessageIntro.getVersionString(),-1, true,"");
|
||||||
sendTextMessage(" Client: "+ getNetworkVersionSVNString(),-1, true,"");
|
sendTextMessage(" Client: "+ getNetworkVersionGITString(),-1, true,"");
|
||||||
sendTextMessage(" Client player [" + playerNameStr + "]",-1, true,"");
|
sendTextMessage(" Client player [" + playerNameStr + "]",-1, true,"");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -581,7 +581,7 @@ void ClientInterface::updateLobby() {
|
||||||
|
|
||||||
string playerNameStr = getHumanPlayerName();
|
string playerNameStr = getHumanPlayerName();
|
||||||
sErr = "Warning, Server and client are using the same version but different platforms.\n\nServer: " + networkMessageIntro.getVersionString() +
|
sErr = "Warning, Server and client are using the same version but different platforms.\n\nServer: " + networkMessageIntro.getVersionString() +
|
||||||
"\nClient: " + getNetworkVersionSVNString() + " player [" + playerNameStr + "]";
|
"\nClient: " + getNetworkVersionGITString() + " player [" + playerNameStr + "]";
|
||||||
//printf("%s\n",sErr.c_str());
|
//printf("%s\n",sErr.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -604,7 +604,7 @@ void ClientInterface::updateLobby() {
|
||||||
//send intro message
|
//send intro message
|
||||||
Lang &lang= Lang::getInstance();
|
Lang &lang= Lang::getInstance();
|
||||||
NetworkMessageIntro sendNetworkMessageIntro(
|
NetworkMessageIntro sendNetworkMessageIntro(
|
||||||
sessionKey,getNetworkVersionSVNString(),
|
sessionKey,getNetworkVersionGITString(),
|
||||||
getHumanPlayerName(),
|
getHumanPlayerName(),
|
||||||
-1,
|
-1,
|
||||||
nmgstOk,
|
nmgstOk,
|
||||||
|
|
|
@ -678,7 +678,7 @@ void ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
||||||
|
|
||||||
NetworkMessageIntro networkMessageIntro(
|
NetworkMessageIntro networkMessageIntro(
|
||||||
sessionKey,
|
sessionKey,
|
||||||
getNetworkVersionSVNString(),
|
getNetworkVersionGITString(),
|
||||||
getHostName(),
|
getHostName(),
|
||||||
playerIndex,
|
playerIndex,
|
||||||
nmgstOk,
|
nmgstOk,
|
||||||
|
@ -954,7 +954,7 @@ void ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
||||||
//check consistency
|
//check consistency
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
bool compatible = checkVersionComptability(getNetworkVersionSVNString(), networkMessageIntro.getVersionString());
|
bool compatible = checkVersionComptability(getNetworkVersionGITString(), networkMessageIntro.getVersionString());
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
|
@ -967,12 +967,12 @@ void ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
||||||
|
|
||||||
if(strncmp(platformFreeVersion.c_str(),networkMessageIntro.getVersionString().c_str(),strlen(platformFreeVersion.c_str())) != 0) {
|
if(strncmp(platformFreeVersion.c_str(),networkMessageIntro.getVersionString().c_str(),strlen(platformFreeVersion.c_str())) != 0) {
|
||||||
string playerNameStr = name;
|
string playerNameStr = name;
|
||||||
sErr = "Server and client binary mismatch!\nYou have to use the exactly same binaries!\n\nServer: " + getNetworkVersionSVNString() +
|
sErr = "Server and client binary mismatch!\nYou have to use the exactly same binaries!\n\nServer: " + getNetworkVersionGITString() +
|
||||||
"\nClient: " + networkMessageIntro.getVersionString() + " player [" + playerNameStr + "]";
|
"\nClient: " + networkMessageIntro.getVersionString() + " player [" + playerNameStr + "]";
|
||||||
printf("%s\n",sErr.c_str());
|
printf("%s\n",sErr.c_str());
|
||||||
|
|
||||||
serverInterface->sendTextMessage("Server and client binary mismatch!!",-1, true,"",lockedSlotIndex);
|
serverInterface->sendTextMessage("Server and client binary mismatch!!",-1, true,"",lockedSlotIndex);
|
||||||
serverInterface->sendTextMessage(" Server:" + getNetworkVersionSVNString(),-1, true,"",lockedSlotIndex);
|
serverInterface->sendTextMessage(" Server:" + getNetworkVersionGITString(),-1, true,"",lockedSlotIndex);
|
||||||
serverInterface->sendTextMessage(" Client: "+ networkMessageIntro.getVersionString(),-1, true,"",lockedSlotIndex);
|
serverInterface->sendTextMessage(" Client: "+ networkMessageIntro.getVersionString(),-1, true,"",lockedSlotIndex);
|
||||||
serverInterface->sendTextMessage(" Client player [" + playerNameStr + "]",-1, true,"",lockedSlotIndex);
|
serverInterface->sendTextMessage(" Client player [" + playerNameStr + "]",-1, true,"",lockedSlotIndex);
|
||||||
}
|
}
|
||||||
|
@ -980,7 +980,7 @@ void ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
||||||
versionMatched = true;
|
versionMatched = true;
|
||||||
|
|
||||||
string playerNameStr = name;
|
string playerNameStr = name;
|
||||||
sErr = "Warning, Server and client are using the same version but different platforms.\n\nServer: " + getNetworkVersionSVNString() +
|
sErr = "Warning, Server and client are using the same version but different platforms.\n\nServer: " + getNetworkVersionGITString() +
|
||||||
"\nClient: " + networkMessageIntro.getVersionString() + " player [" + playerNameStr + "]";
|
"\nClient: " + networkMessageIntro.getVersionString() + " player [" + playerNameStr + "]";
|
||||||
//printf("%s\n",sErr.c_str());
|
//printf("%s\n",sErr.c_str());
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] %s\n",__FILE__,__FUNCTION__,__LINE__,sErr.c_str());
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] %s\n",__FILE__,__FUNCTION__,__LINE__,sErr.c_str());
|
||||||
|
|
|
@ -2775,7 +2775,7 @@ std::map<string,string> ServerInterface::publishToMasterserver() {
|
||||||
}
|
}
|
||||||
publishToServerInfo["uuid"] = Config::getInstance().getString("PlayerId","");
|
publishToServerInfo["uuid"] = Config::getInstance().getString("PlayerId","");
|
||||||
publishToServerInfo["glestVersion"] = glestVersionString;
|
publishToServerInfo["glestVersion"] = glestVersionString;
|
||||||
publishToServerInfo["platform"] = getPlatformNameString() + "-" + getSVNRevisionString();
|
publishToServerInfo["platform"] = getPlatformNameString() + "-" + getGITRevisionString();
|
||||||
publishToServerInfo["binaryCompileDate"] = getCompileDateTime();
|
publishToServerInfo["binaryCompileDate"] = getCompileDateTime();
|
||||||
publishToServerInfo["serverTitle"] = getHumanPlayerName() + "'s game";
|
publishToServerInfo["serverTitle"] = getHumanPlayerName() + "'s game";
|
||||||
publishToServerInfo["tech"] = this->getGameSettings()->getTech();
|
publishToServerInfo["tech"] = this->getGameSettings()->getTech();
|
||||||
|
|
|
@ -186,9 +186,9 @@ void findAll(const string &path, vector<string> &results, bool cutExtension=fals
|
||||||
vector<string> getFolderTreeContentsListRecursively(const string &path, const string &filterFileExt, bool includeFolders=false, vector<string> *recursiveMap=NULL);
|
vector<string> getFolderTreeContentsListRecursively(const string &path, const string &filterFileExt, bool includeFolders=false, vector<string> *recursiveMap=NULL);
|
||||||
|
|
||||||
string getGameVersion();
|
string getGameVersion();
|
||||||
string getGameSVNVersion();
|
string getGameGITVersion();
|
||||||
void setGameVersion(string version);
|
void setGameVersion(string version);
|
||||||
void setGameSVNVersion(string svn);
|
void setGameGITVersion(string git);
|
||||||
|
|
||||||
string getCRCCacheFilePath();
|
string getCRCCacheFilePath();
|
||||||
void setCRCCacheFilePath(string path);
|
void setCRCCacheFilePath(string path);
|
||||||
|
|
|
@ -91,7 +91,7 @@ const time_t REFRESH_CRC_DAY_SECONDS = 60 * 60 * 24;
|
||||||
static string crcCachePath = "";
|
static string crcCachePath = "";
|
||||||
|
|
||||||
static string gameVersion = "";
|
static string gameVersion = "";
|
||||||
static string gameSVNVersion = "";
|
static string gameGITVersion = "";
|
||||||
|
|
||||||
namespace Private {
|
namespace Private {
|
||||||
|
|
||||||
|
@ -373,7 +373,7 @@ void findAll(const string &path, vector<string> &results, bool cutExtension, boo
|
||||||
if(*p == '/')
|
if(*p == '/')
|
||||||
begin = p+1;
|
begin = p+1;
|
||||||
}
|
}
|
||||||
if(!(strcmp(".", begin)==0 || strcmp("..", begin)==0 || strcmp(".svn", begin)==0)) {
|
if(!(strcmp(".", begin)==0 || strcmp("..", begin)==0 || strcmp(".git", begin)==0)) {
|
||||||
results.push_back(begin);
|
results.push_back(begin);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -472,7 +472,7 @@ void removeFolder(const string &path) {
|
||||||
for(int i = (int)results.size() -1; i >= 0; --i) {
|
for(int i = (int)results.size() -1; i >= 0; --i) {
|
||||||
string item = results[i];
|
string item = results[i];
|
||||||
|
|
||||||
//if(item.find(".svn") != string::npos) {
|
//if(item.find(".git") != string::npos) {
|
||||||
// printf("!!!!!!!!!!!!!!!!!! FOUND SPECIAL FOLDER [%s] in [%s]\n",item.c_str(),path.c_str());
|
// printf("!!!!!!!!!!!!!!!!!! FOUND SPECIAL FOLDER [%s] in [%s]\n",item.c_str(),path.c_str());
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
@ -646,14 +646,14 @@ void setCRCCacheFilePath(string path) {
|
||||||
string getGameVersion() {
|
string getGameVersion() {
|
||||||
return gameVersion;
|
return gameVersion;
|
||||||
}
|
}
|
||||||
string getGameSVNVersion() {
|
string getGameGITVersion() {
|
||||||
return gameSVNVersion;
|
return gameGITVersion;
|
||||||
}
|
}
|
||||||
void setGameVersion(string version) {
|
void setGameVersion(string version) {
|
||||||
gameVersion = version;
|
gameVersion = version;
|
||||||
}
|
}
|
||||||
void setGameSVNVersion(string svn) {
|
void setGameGITVersion(string git) {
|
||||||
gameSVNVersion = svn;
|
gameGITVersion = git;
|
||||||
}
|
}
|
||||||
|
|
||||||
string getCRCCacheFileName(std::pair<string,string> cacheKeys) {
|
string getCRCCacheFileName(std::pair<string,string> cacheKeys) {
|
||||||
|
@ -705,23 +705,23 @@ pair<bool,time_t> hasCachedFileCRCValue(string crcCacheFile, uint32 &value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
char gameVer[500]="";
|
char gameVer[500]="";
|
||||||
char svnVer[500]="";
|
char gitVer[500]="";
|
||||||
char actualFilePath[8096]="";
|
char actualFilePath[8096]="";
|
||||||
int readbytes = fscanf(fp,"%20ld,%20u,%20ld\n%499s\n%499s\n%8095s",
|
int readbytes = fscanf(fp,"%20ld,%20u,%20ld\n%499s\n%499s\n%8095s",
|
||||||
&refreshDate,
|
&refreshDate,
|
||||||
&crcValue,
|
&crcValue,
|
||||||
&lastUpdateDate,
|
&lastUpdateDate,
|
||||||
&gameVer[0],
|
&gameVer[0],
|
||||||
&svnVer[0],
|
&gitVer[0],
|
||||||
&actualFilePath[0]);
|
&actualFilePath[0]);
|
||||||
refreshDate = Shared::PlatformByteOrder::fromCommonEndian(refreshDate);
|
refreshDate = Shared::PlatformByteOrder::fromCommonEndian(refreshDate);
|
||||||
crcValue = Shared::PlatformByteOrder::fromCommonEndian(crcValue);
|
crcValue = Shared::PlatformByteOrder::fromCommonEndian(crcValue);
|
||||||
lastUpdateDate = Shared::PlatformByteOrder::fromCommonEndian(lastUpdateDate);
|
lastUpdateDate = Shared::PlatformByteOrder::fromCommonEndian(lastUpdateDate);
|
||||||
string readGameVer = Shared::PlatformByteOrder::fromCommonEndian(string(gameVer));
|
string readGameVer = Shared::PlatformByteOrder::fromCommonEndian(string(gameVer));
|
||||||
string readSvnVer = Shared::PlatformByteOrder::fromCommonEndian(string(svnVer));
|
string readGitVer = Shared::PlatformByteOrder::fromCommonEndian(string(gitVer));
|
||||||
string readActualFilePath = Shared::PlatformByteOrder::fromCommonEndian(string(actualFilePath));
|
string readActualFilePath = Shared::PlatformByteOrder::fromCommonEndian(string(actualFilePath));
|
||||||
|
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("CRC readGameVer [%s] [%s]\n%s\n",readGameVer.c_str(),readSvnVer.c_str(),readActualFilePath.c_str());
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("CRC readGameVer [%s] [%s]\n%s\n",readGameVer.c_str(),readGitVer.c_str(),readActualFilePath.c_str());
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) {
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] Line: %d for Cache file [%s] readbytes = %d\n",__FILE__,__FUNCTION__,__LINE__,crcCacheFile.c_str(),readbytes);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] Line: %d for Cache file [%s] readbytes = %d\n",__FILE__,__FUNCTION__,__LINE__,crcCacheFile.c_str(),readbytes);
|
||||||
|
@ -744,7 +744,7 @@ pair<bool,time_t> hasCachedFileCRCValue(string crcCacheFile, uint32 &value) {
|
||||||
time_t tBadCRCDate = mktime( &future );
|
time_t tBadCRCDate = mktime( &future );
|
||||||
|
|
||||||
result.second = lastUpdateDate;
|
result.second = lastUpdateDate;
|
||||||
if( readGameVer != "" && readSvnVer != "" &&
|
if( readGameVer != "" && readGitVer != "" &&
|
||||||
refreshDate > 0 &&
|
refreshDate > 0 &&
|
||||||
refreshDate > tBadCRCDate &&
|
refreshDate > tBadCRCDate &&
|
||||||
time(NULL) < refreshDate) {
|
time(NULL) < refreshDate) {
|
||||||
|
@ -816,7 +816,7 @@ void writeCachedFileCRCValue(string crcCacheFile, uint32 &crcValue, string actua
|
||||||
strftime(szBuf1,100,"%Y-%m-%d %H:%M:%S",loctime);
|
strftime(szBuf1,100,"%Y-%m-%d %H:%M:%S",loctime);
|
||||||
|
|
||||||
string writeGameVer = Shared::PlatformByteOrder::toCommonEndian(gameVersion);
|
string writeGameVer = Shared::PlatformByteOrder::toCommonEndian(gameVersion);
|
||||||
string writeGameSVNVersion = Shared::PlatformByteOrder::toCommonEndian(gameSVNVersion);
|
string writeGameGITVersion = Shared::PlatformByteOrder::toCommonEndian(gameGITVersion);
|
||||||
string writeActualFileName = Shared::PlatformByteOrder::toCommonEndian(actualFileName);
|
string writeActualFileName = Shared::PlatformByteOrder::toCommonEndian(actualFileName);
|
||||||
|
|
||||||
fprintf(fp,"%20ld,%20u,%20ld",
|
fprintf(fp,"%20ld,%20u,%20ld",
|
||||||
|
@ -826,7 +826,7 @@ void writeCachedFileCRCValue(string crcCacheFile, uint32 &crcValue, string actua
|
||||||
|
|
||||||
fprintf(fp,"\n%s\n%s\n%s",
|
fprintf(fp,"\n%s\n%s\n%s",
|
||||||
writeGameVer.c_str(),
|
writeGameVer.c_str(),
|
||||||
writeGameSVNVersion.c_str(),
|
writeGameGITVersion.c_str(),
|
||||||
writeActualFileName.c_str());
|
writeActualFileName.c_str());
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
@ -1040,7 +1040,7 @@ uint32 getFolderTreeContentsCheckSumRecursively(const string &path, const string
|
||||||
|
|
||||||
if(isdir(p) == false) {
|
if(isdir(p) == false) {
|
||||||
bool addFile = true;
|
bool addFile = true;
|
||||||
if(EndsWith(p, ".") == true || EndsWith(p, "..") == true || EndsWith(p, ".svn") == true) {
|
if(EndsWith(p, ".") == true || EndsWith(p, "..") == true || EndsWith(p, ".git") == true) {
|
||||||
addFile = false;
|
addFile = false;
|
||||||
}
|
}
|
||||||
else if(filterFileExt != "") {
|
else if(filterFileExt != "") {
|
||||||
|
@ -1359,7 +1359,7 @@ vector<std::pair<string,uint32> > getFolderTreeContentsCheckSumListRecursively(c
|
||||||
|
|
||||||
if(isdir(p) == false) {
|
if(isdir(p) == false) {
|
||||||
bool addFile = true;
|
bool addFile = true;
|
||||||
if(EndsWith(p, ".") == true || EndsWith(p, "..") == true || EndsWith(p, ".svn") == true) {
|
if(EndsWith(p, ".") == true || EndsWith(p, "..") == true || EndsWith(p, ".git") == true) {
|
||||||
addFile = false;
|
addFile = false;
|
||||||
}
|
}
|
||||||
else if(filterFileExt != "") {
|
else if(filterFileExt != "") {
|
||||||
|
|
Loading…
Reference in New Issue