From b3499c54ae8f7d88b3a0cfc14d3a78460f1d6b2a Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Thu, 25 Apr 2024 18:52:25 +0300 Subject: [PATCH 1/5] Added "ENABLE_GOLDMASTER" switch Intended for functionality that should be disabled or enabled in public releases. Largely replaces existing ENABLE_GITVERSION switch, which is now always disabled if GOLDMASTER is in use --- .github/workflows/github.yml | 4 ++-- CI/get_package_name.sh | 6 +++--- CMakeLists.txt | 8 ++++++-- CMakePresets.json | 2 +- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.github/workflows/github.yml b/.github/workflows/github.yml index 450f6b7b5..5568b6e9c 100644 --- a/.github/workflows/github.yml +++ b/.github/workflows/github.yml @@ -195,7 +195,7 @@ jobs: fi echo VCMI_PACKAGE_FILE_NAME="$VCMI_PACKAGE_FILE_NAME" >> $GITHUB_ENV echo VCMI_PACKAGE_NAME_SUFFIX="$VCMI_PACKAGE_NAME_SUFFIX" >> $GITHUB_ENV - echo VCMI_PACKAGE_GITVERSION="$VCMI_PACKAGE_GITVERSION" >> $GITHUB_ENV + echo VCMI_PACKAGE_GOLDMASTER="$VCMI_PACKAGE_GOLDMASTER" >> $GITHUB_ENV env: PULL_REQUEST: ${{ github.event.pull_request.number }} @@ -351,7 +351,7 @@ jobs: fi echo VCMI_PACKAGE_FILE_NAME="$VCMI_PACKAGE_FILE_NAME" >> $GITHUB_ENV echo VCMI_PACKAGE_NAME_SUFFIX="$VCMI_PACKAGE_NAME_SUFFIX" >> $GITHUB_ENV - echo VCMI_PACKAGE_GITVERSION="$VCMI_PACKAGE_GITVERSION" >> $GITHUB_ENV + echo VCMI_PACKAGE_GOLDMASTER="$VCMI_PACKAGE_GOLDMASTER" >> $GITHUB_ENV env: PULL_REQUEST: ${{ github.event.pull_request.number }} diff --git a/CI/get_package_name.sh b/CI/get_package_name.sh index 235e39930..4f8504c4b 100644 --- a/CI/get_package_name.sh +++ b/CI/get_package_name.sh @@ -27,7 +27,7 @@ fi VCMI_PACKAGE_FILE_NAME="${TMP_JOBID}-vcmi" VCMI_PACKAGE_NAME_SUFFIX="" -VCMI_PACKAGE_GITVERSION="ON" +VCMI_PACKAGE_GOLDMASTER="ON" if [ -z "$TMP_PRID" ] || [ "$TMP_PRID" == "false" ]; then branch_name=$(echo "$TMP_BRANCH" | sed 's/[^[:alnum:]]\+/_/g') @@ -36,7 +36,7 @@ then then VCMI_PACKAGE_NAME_SUFFIX="branch ${branch_name}" else - VCMI_PACKAGE_GITVERSION="OFF" + VCMI_PACKAGE_GOLDMASTER="OFF" fi else VCMI_PACKAGE_FILE_NAME="${VCMI_PACKAGE_FILE_NAME}-PR-${TMP_PRID}-${TMP_COMMIT}" @@ -50,4 +50,4 @@ fi export VCMI_PACKAGE_FILE_NAME export VCMI_PACKAGE_NAME_SUFFIX -export VCMI_PACKAGE_GITVERSION \ No newline at end of file +export VCMI_PACKAGE_GOLDMASTER \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 4fd2d0fa8..b84ebaf9c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,8 +43,8 @@ option(ENABLE_ERM "Enable compilation of ERM scripting module" OFF) option(ENABLE_LUA "Enable compilation of LUA scripting module" OFF) option(ENABLE_TRANSLATIONS "Enable generation of translations for launcher and editor" ON) option(ENABLE_NULLKILLER_AI "Enable compilation of Nullkiller AI library" ON) -option(ENABLE_GITVERSION "Enable Version.cpp with Git commit hash" ON) option(ENABLE_MINIMAL_LIB "Build only core parts of vcmi library that are required for game lobby" OFF) +option(ENABLE_GOLDMASTER "Build in public release mode in which some debug routines are disabled" OFF) # Compilation options @@ -90,6 +90,7 @@ endif() include(CMakeDependentOption) cmake_dependent_option(ENABLE_INNOEXTRACT "Enable innoextract for GOG file extraction in launcher" ON "ENABLE_LAUNCHER" OFF) +cmake_dependent_option(ENABLE_GITVERSION "Enable Version.cpp with Git commit hash" ON "NOT ENABLE_GOLDMASTER" OFF) ############################################ # Miscellaneous options # @@ -239,7 +240,6 @@ elseif(${CMAKE_CXX_BYTE_ORDER} EQUAL "BIG_ENDIAN") add_definitions(-DVCMI_ENDIAN_BIG) endif() - if(ENABLE_LAUNCHER) add_definitions(-DENABLE_LAUNCHER) endif() @@ -256,6 +256,10 @@ if(ENABLE_MINIMAL_LIB) add_definitions(-DENABLE_MINIMAL_LIB) endif() +if(ENABLE_GOLDMASTER) + add_definitions(-DENABLE_GOLDMASTER) +endif() + if(APPLE_IOS) set(CMAKE_MACOSX_RPATH 1) set(CMAKE_OSX_DEPLOYMENT_TARGET 12.0) diff --git a/CMakePresets.json b/CMakePresets.json index d35b24e74..41fd2fac4 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -25,7 +25,7 @@ "CMAKE_BUILD_TYPE": "RelWithDebInfo", "ENABLE_TEST": "OFF", "ENABLE_STRICT_COMPILATION": "ON", - "ENABLE_GITVERSION": "$env{VCMI_PACKAGE_GITVERSION}", + "ENABLE_GOLDMASTER": "$env{VCMI_PACKAGE_GOLDMASTER}", "ENABLE_PCH" : "OFF" } }, From 98416acac43092ae69901c6a89d13ddf59f8244f Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Thu, 25 Apr 2024 18:52:53 +0300 Subject: [PATCH 2/5] Hide error messages from server in goldmaster mode --- server/CGameHandler.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/CGameHandler.cpp b/server/CGameHandler.cpp index d89e77c33..7a417ff75 100644 --- a/server/CGameHandler.cpp +++ b/server/CGameHandler.cpp @@ -3389,7 +3389,9 @@ void CGameHandler::handleTownEvents(CGTownInstance * town, NewTurn &n) bool CGameHandler::complain(const std::string &problem) { +#ifndef ENABLE_GOLDMASTER playerMessages->broadcastSystemMessage("Server encountered a problem: " + problem); +#endif logGlobal->error(problem); return true; } From fca53e4dbc274874fbc1015aff908d3fb0ea953c Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Thu, 25 Apr 2024 18:53:12 +0300 Subject: [PATCH 3/5] Do not show "(client)" in window title --- client/renderSDL/ScreenHandler.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/client/renderSDL/ScreenHandler.cpp b/client/renderSDL/ScreenHandler.cpp index 527b4ac75..f08f80c4d 100644 --- a/client/renderSDL/ScreenHandler.cpp +++ b/client/renderSDL/ScreenHandler.cpp @@ -37,8 +37,7 @@ SDL_Surface * screen = nullptr; //main screen surface SDL_Surface * screen2 = nullptr; //and hlp surface (used to store not-active interfaces layer) SDL_Surface * screenBuf = screen; //points to screen (if only advmapint is present) or screen2 (else) - should be used when updating controls which are not regularly redrawed -static const std::string NAME_AFFIX = "client"; -static const std::string NAME = GameConstants::VCMI_VERSION + std::string(" (") + NAME_AFFIX + ')'; //application name +static const std::string NAME = GameConstants::VCMI_VERSION; //application name std::tuple ScreenHandler::getSupportedScalingRange() const { From 83a651f7c8e4c91db2337c5c525294f47ec868df Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Thu, 25 Apr 2024 18:53:34 +0300 Subject: [PATCH 4/5] Fixed broken server port switch in launcher --- launcher/settingsView/csettingsview_moc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/settingsView/csettingsview_moc.cpp b/launcher/settingsView/csettingsview_moc.cpp index fa5c97be6..a4f047741 100644 --- a/launcher/settingsView/csettingsview_moc.cpp +++ b/launcher/settingsView/csettingsview_moc.cpp @@ -94,7 +94,7 @@ void CSettingsView::loadSettings() ui->comboBoxEnemyPlayerAI->setCurrentText(QString::fromStdString(settings["server"]["playerAI"].String())); ui->comboBoxAlliedPlayerAI->setCurrentText(QString::fromStdString(settings["server"]["alliedAI"].String())); - ui->spinBoxNetworkPort->setValue(settings["server"]["port"].Integer()); + ui->spinBoxNetworkPort->setValue(settings["server"]["localPort"].Integer()); ui->comboBoxAutoCheck->setCurrentIndex(settings["launcher"]["autoCheckRepositories"].Bool()); From 99281cf987733420ca914ae98dce5c272b3f1918 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Thu, 25 Apr 2024 19:18:36 +0300 Subject: [PATCH 5/5] Fix ENABLE_GOLDMASTER usage --- CI/get_package_name.sh | 4 ++-- debian/rules | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CI/get_package_name.sh b/CI/get_package_name.sh index 4f8504c4b..2bae1794e 100644 --- a/CI/get_package_name.sh +++ b/CI/get_package_name.sh @@ -27,7 +27,7 @@ fi VCMI_PACKAGE_FILE_NAME="${TMP_JOBID}-vcmi" VCMI_PACKAGE_NAME_SUFFIX="" -VCMI_PACKAGE_GOLDMASTER="ON" +VCMI_PACKAGE_GOLDMASTER="OFF" if [ -z "$TMP_PRID" ] || [ "$TMP_PRID" == "false" ]; then branch_name=$(echo "$TMP_BRANCH" | sed 's/[^[:alnum:]]\+/_/g') @@ -36,7 +36,7 @@ then then VCMI_PACKAGE_NAME_SUFFIX="branch ${branch_name}" else - VCMI_PACKAGE_GOLDMASTER="OFF" + VCMI_PACKAGE_GOLDMASTER="ON" fi else VCMI_PACKAGE_FILE_NAME="${VCMI_PACKAGE_FILE_NAME}-PR-${TMP_PRID}-${TMP_COMMIT}" diff --git a/debian/rules b/debian/rules index a0f3fb95d..7051f2b20 100755 --- a/debian/rules +++ b/debian/rules @@ -9,7 +9,7 @@ override_dh_auto_configure: -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON \ -DCMAKE_INSTALL_RPATH=/usr/lib/$(DEB_HOST_MULTIARCH)/vcmi \ -DCMAKE_BUILD_TYPE=Release \ - -DENABLE_GITVERSION=OFF \ + -DENABLE_GOLDMASTER=ON \ -DBIN_DIR=games \ -DFORCE_BUNDLED_FL=OFF \ -DENABLE_TEST=0