From fd0c20f31a434f27e21da34d0a50081431eef228 Mon Sep 17 00:00:00 2001 From: Romain <66537460+rmnvgr@users.noreply.github.com> Date: Mon, 7 Apr 2025 23:43:27 +0200 Subject: [PATCH] Allow disabling the version checker --- CMakeLists.txt | 6 +++++- src/openrct2/Version.cpp | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a49788c0fd..522a7ce439 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -110,6 +110,7 @@ option(DISABLE_GOOGLE_BENCHMARK "Disable Google Benchmarks support." ON) option(DISABLE_HTTP "Disable HTTP support.") option(DISABLE_NETWORK "Disable multiplayer functionality. Mainly for testing.") option(DISABLE_TTF "Disable support for TTF provided by freetype2.") +option(DISABLE_VERSION_CHECKER "Disable the check for newer versions.") option(ENABLE_SCRIPTING "Enable script / plugin support." ON) option(ENABLE_ASAN "Enable the AddressSanitizer.") option(ENABLE_UBSAN "Enable the UndefinedBehaviourSanitizer.") @@ -136,7 +137,7 @@ if (MACOS_USE_DEPENDENCIES) message("Using OpenRCT2 dependencies instead of system libraries") # if we're building on macOS, then we need the dependencies include(cmake/download.cmake) - + set(MACOS_DYLIBS_VERSION "37") set(MACOS_DYLIBS_ZIPFILE "openrct2-libs-v${MACOS_DYLIBS_VERSION}-universal-macos-dylibs.zip") set(MACOS_DYLIBS_SHA1 "6d633a881fc243e960e29d9c371915a7cdeeb880") @@ -397,6 +398,9 @@ endif () if (DISABLE_TTF) target_compile_options(libopenrct2 PUBLIC -DNO_TTF) endif () +if (DISABLE_VERSION_CHECKER) + target_compile_options(libopenrct2 PUBLIC -DDISABLE_VERSION_CHECKER) +endif () if (ENABLE_SCRIPTING) target_compile_options(libopenrct2 PUBLIC -DENABLE_SCRIPTING) endif () diff --git a/src/openrct2/Version.cpp b/src/openrct2/Version.cpp index 49fcb39ac0..04c29c56a7 100644 --- a/src/openrct2/Version.cpp +++ b/src/openrct2/Version.cpp @@ -71,7 +71,7 @@ NewVersionInfo GetLatestVersion() // with invalid data. std::string tag = gVersionInfoTag; NewVersionInfo verinfo{ tag, "", "", "" }; -#ifndef DISABLE_HTTP +#if !defined(DISABLE_HTTP) && !defined(DISABLE_VERSION_CHECKER) auto now = std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count(); auto then = Config::Get().general.LastVersionCheckTime; using namespace std::chrono_literals;