From e83b86df4de0d94e87b369d5839f02de979ba0da Mon Sep 17 00:00:00 2001 From: Michael Steenbeek Date: Mon, 8 Jun 2020 15:11:07 +0200 Subject: [PATCH] Replace occurrences of OpenRCT with OpenRCT2 (#11898) --- distribution/changelog.txt | 1 + distribution/man/openrct2.6 | 4 +- scripts/linux/build.sh | 8 ++-- src/openrct2/Context.cpp | 2 +- src/openrct2/OpenRCT2.cpp | 2 +- src/openrct2/OpenRCT2.h | 2 +- src/openrct2/PlatformEnvironment.cpp | 4 +- src/openrct2/cmdline/RootCommands.cpp | 42 +++++++++---------- src/openrct2/drawing/Drawing.Sprite.cpp | 2 +- src/openrct2/localisation/Date.h | 4 +- .../localisation/Localisation.Date.cpp | 2 +- src/openrct2/platform/Platform.Linux.cpp | 2 +- src/openrct2/platform/Platform.Win32.cpp | 2 +- src/openrct2/platform/Platform.macOS.mm | 2 +- src/openrct2/platform/macos.mm | 2 +- src/openrct2/platform/platform.h | 4 +- test/testpaint/main.cpp | 2 +- 17 files changed, 44 insertions(+), 43 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index c33f05970a..9c6d4de512 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -13,6 +13,7 @@ - Change: [#11209] Warn when user is running OpenRCT2 through Wine. - Change: [#11358] Switch copy and paste button positions in tile inspector. - Change: [#11449] Remove complete circuit requirement from Air Powered Vertical Coaster (for RCT1 parity). +- Change: [#11898] The `openrct-data-path` command-line argument has been renamed to `openrct2-data-path`. - Fix: [#1013] Negative length displayed in Ride window. - Fix: [#1148] Research funding dropdown not shown in finances window. - Fix: [#5451] Guests scream on every descent, no matter how small. diff --git a/distribution/man/openrct2.6 b/distribution/man/openrct2.6 index 2f6ceb1dfe..bf2e621087 100644 --- a/distribution/man/openrct2.6 +++ b/distribution/man/openrct2.6 @@ -86,7 +86,7 @@ spritefile idx output spritefile output_directory .Sh OPTIONS -.Bl -tag -width "-openrct-data-path path " +.Bl -tag -width "-openrct2-data-path path " .It Fl h | -help Print a summary of all options to stdout and exit. @@ -122,7 +122,7 @@ Password needed to join the server. Path to the user data directory (containing .Pa config.ini ) -.It Fl -openrct-data-path Ar path +.It Fl -openrct2-data-path Ar path Path to the OpenRCT2 data directory (containing .Pa languages ) diff --git a/scripts/linux/build.sh b/scripts/linux/build.sh index 45ce1b2756..c668f3e03a 100755 --- a/scripts/linux/build.sh +++ b/scripts/linux/build.sh @@ -30,19 +30,19 @@ pushd build if [[ $TARGET == "docker64" ]] then # CMAKE and MAKE opts from environment - docker run $ci_env -e CCACHE_DIR=/ccache -v $HOME/.ccache:/ccache -v "$PARENT":"$PARENT" -w "$PARENT"/build -i -t openrct2/openrct2:64bit-only bash -c "export PATH=/usr/lib/ccache/bin:\$PATH LD_PRELOAD=/usr/lib/libSegFault.so && ccache --show-stats > ccache_before && cmake ../ -DWITH_TESTS=on $OPENRCT2_CMAKE_OPTS && ninja all install $OPENRCT_MAKE_OPTS && ccache --show-stats > ccache_after && ( diff -U100 ccache_before ccache_after || true ) && ./openrct2-cli scan-objects && ctest --output-on-failure && cd .. && bash <(curl -s https://codecov.io/bash) 2>\&1 | grep -v \"has arcs\"" + docker run $ci_env -e CCACHE_DIR=/ccache -v $HOME/.ccache:/ccache -v "$PARENT":"$PARENT" -w "$PARENT"/build -i -t openrct2/openrct2:64bit-only bash -c "export PATH=/usr/lib/ccache/bin:\$PATH LD_PRELOAD=/usr/lib/libSegFault.so && ccache --show-stats > ccache_before && cmake ../ -DWITH_TESTS=on $OPENRCT2_CMAKE_OPTS && ninja all install $OPENRCT2_MAKE_OPTS && ccache --show-stats > ccache_after && ( diff -U100 ccache_before ccache_after || true ) && ./openrct2-cli scan-objects && ctest --output-on-failure && cd .. && bash <(curl -s https://codecov.io/bash) 2>\&1 | grep -v \"has arcs\"" elif [[ $TARGET == "ubuntu_i686" ]] then # CMAKE and MAKE opts from environment - docker run $ci_env -e CCACHE_DIR=/ccache -v $HOME/.ccache:/ccache -v "$PARENT":"$PARENT" -w "$PARENT"/build -i -t openrct2/openrct2:ubuntu_i686 bash -c "export PATH=/usr/lib/ccache:\$PATH && ccache --show-stats > ccache_before && cmake ../ -DWITH_TESTS=on $OPENRCT2_CMAKE_OPTS && ninja all testpaint install $OPENRCT_MAKE_OPTS && ccache --show-stats > ccache_after && ( diff -U100 ccache_before ccache_after || true ) && LD_PRELOAD=/lib/i386-linux-gnu/libSegFault.so ./openrct2-cli scan-objects && LD_PRELOAD=/lib/i386-linux-gnu/libSegFault.so ctest --output-on-failure && ( LD_PRELOAD=/lib/i386-linux-gnu/libSegFault.so ./testpaint --quiet || if [[ \$? -eq 1 ]] ; then echo Allowing failed tests to pass ; else echo here ; false; fi ) && cd .. && bash <(curl -s https://codecov.io/bash)" + docker run $ci_env -e CCACHE_DIR=/ccache -v $HOME/.ccache:/ccache -v "$PARENT":"$PARENT" -w "$PARENT"/build -i -t openrct2/openrct2:ubuntu_i686 bash -c "export PATH=/usr/lib/ccache:\$PATH && ccache --show-stats > ccache_before && cmake ../ -DWITH_TESTS=on $OPENRCT2_CMAKE_OPTS && ninja all testpaint install $OPENRCT2_MAKE_OPTS && ccache --show-stats > ccache_after && ( diff -U100 ccache_before ccache_after || true ) && LD_PRELOAD=/lib/i386-linux-gnu/libSegFault.so ./openrct2-cli scan-objects && LD_PRELOAD=/lib/i386-linux-gnu/libSegFault.so ctest --output-on-failure && ( LD_PRELOAD=/lib/i386-linux-gnu/libSegFault.so ./testpaint --quiet || if [[ \$? -eq 1 ]] ; then echo Allowing failed tests to pass ; else echo here ; false; fi ) && cd .. && bash <(curl -s https://codecov.io/bash)" elif [[ $TARGET == "ubuntu_amd64" ]] then # CMAKE and MAKE opts from environment - docker run $ci_env -e CCACHE_DIR=/ccache -v $HOME/.ccache:/ccache -v "$PARENT":"$PARENT" -w "$PARENT"/build -i -t openrct2/openrct2:ubuntu_amd64 bash -c "export PATH=/usr/lib/ccache:\$PATH LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so && ccache --show-stats > ccache_before && cmake ../ -DWITH_TESTS=on $OPENRCT2_CMAKE_OPTS && ninja $OPENRCT_MAKE_OPTS install && ccache --show-stats > ccache_after && ( diff -U100 ccache_before ccache_after || true ) && ./openrct2-cli scan-objects && ctest --output-on-failure && cd .. && bash <(curl -s https://codecov.io/bash)" + docker run $ci_env -e CCACHE_DIR=/ccache -v $HOME/.ccache:/ccache -v "$PARENT":"$PARENT" -w "$PARENT"/build -i -t openrct2/openrct2:ubuntu_amd64 bash -c "export PATH=/usr/lib/ccache:\$PATH LD_PRELOAD=/lib/x86_64-linux-gnu/libSegFault.so && ccache --show-stats > ccache_before && cmake ../ -DWITH_TESTS=on $OPENRCT2_CMAKE_OPTS && ninja $OPENRCT2_MAKE_OPTS install && ccache --show-stats > ccache_after && ( diff -U100 ccache_before ccache_after || true ) && ./openrct2-cli scan-objects && ctest --output-on-failure && cd .. && bash <(curl -s https://codecov.io/bash)" elif [[ $TARGET == "windows" ]] then # CMAKE and MAKE opts from environment - docker run -v "$PARENT":"$PARENT" -w "$PARENT"/build -i -t openrct2/openrct2:mingw-arch bash -c "cmake ../ $OPENRCT2_CMAKE_OPTS && ninja $OPENRCT_MAKE_OPTS" + docker run -v "$PARENT":"$PARENT" -w "$PARENT"/build -i -t openrct2/openrct2:mingw-arch bash -c "cmake ../ $OPENRCT2_CMAKE_OPTS && ninja $OPENRCT2_MAKE_OPTS" else echo "Unkown target $TARGET" exit 1 diff --git a/src/openrct2/Context.cpp b/src/openrct2/Context.cpp index 4fcfd1e40c..8d8abe7aac 100644 --- a/src/openrct2/Context.cpp +++ b/src/openrct2/Context.cpp @@ -1436,7 +1436,7 @@ void platform_get_user_directory(utf8* outPath, const utf8* subDirectory, size_t * This function is deprecated. * Use IPlatformEnvironment instead. */ -void platform_get_openrct_data_path(utf8* outPath, size_t outSize) +void platform_get_openrct2_data_path(utf8* outPath, size_t outSize) { auto env = GetContext()->GetPlatformEnvironment(); auto path = env->GetDirectoryPath(DIRBASE::OPENRCT2); diff --git a/src/openrct2/OpenRCT2.cpp b/src/openrct2/OpenRCT2.cpp index 387f03f4bc..7f392adf93 100644 --- a/src/openrct2/OpenRCT2.cpp +++ b/src/openrct2/OpenRCT2.cpp @@ -13,7 +13,7 @@ int32_t gOpenRCT2StartupAction = STARTUP_ACTION_TITLE; utf8 gOpenRCT2StartupActionPath[512] = { 0 }; utf8 gExePath[MAX_PATH]; utf8 gCustomUserDataPath[MAX_PATH] = { 0 }; -utf8 gCustomOpenrctDataPath[MAX_PATH] = { 0 }; +utf8 gCustomOpenRCT2DataPath[MAX_PATH] = { 0 }; utf8 gCustomRCT1DataPath[MAX_PATH] = { 0 }; utf8 gCustomRCT2DataPath[MAX_PATH] = { 0 }; utf8 gCustomPassword[MAX_PATH] = { 0 }; diff --git a/src/openrct2/OpenRCT2.h b/src/openrct2/OpenRCT2.h index eeeaf5217c..5ca5f27342 100644 --- a/src/openrct2/OpenRCT2.h +++ b/src/openrct2/OpenRCT2.h @@ -38,7 +38,7 @@ extern int32_t gOpenRCT2StartupAction; extern utf8 gOpenRCT2StartupActionPath[512]; extern utf8 gExePath[MAX_PATH]; extern utf8 gCustomUserDataPath[MAX_PATH]; -extern utf8 gCustomOpenrctDataPath[MAX_PATH]; +extern utf8 gCustomOpenRCT2DataPath[MAX_PATH]; extern utf8 gCustomRCT1DataPath[MAX_PATH]; extern utf8 gCustomRCT2DataPath[MAX_PATH]; extern utf8 gCustomPassword[MAX_PATH]; diff --git a/src/openrct2/PlatformEnvironment.cpp b/src/openrct2/PlatformEnvironment.cpp index 5e9898c2ac..4fc6e9b71d 100644 --- a/src/openrct2/PlatformEnvironment.cpp +++ b/src/openrct2/PlatformEnvironment.cpp @@ -142,9 +142,9 @@ std::unique_ptr OpenRCT2::CreatePlatformEnvironment() { basePaths[static_cast(DIRBASE::RCT2)] = gCustomRCT2DataPath; } - if (!String::IsNullOrEmpty(gCustomOpenrctDataPath)) + if (!String::IsNullOrEmpty(gCustomOpenRCT2DataPath)) { - basePaths[static_cast(DIRBASE::OPENRCT2)] = gCustomOpenrctDataPath; + basePaths[static_cast(DIRBASE::OPENRCT2)] = gCustomOpenRCT2DataPath; } if (!String::IsNullOrEmpty(gCustomUserDataPath)) { diff --git a/src/openrct2/cmdline/RootCommands.cpp b/src/openrct2/cmdline/RootCommands.cpp index b39f1fda55..a2ee4f5a78 100644 --- a/src/openrct2/cmdline/RootCommands.cpp +++ b/src/openrct2/cmdline/RootCommands.cpp @@ -54,7 +54,7 @@ static bool _verbose = false; static bool _headless = false; static utf8* _password = nullptr; static utf8* _userDataPath = nullptr; -static utf8* _openrctDataPath = nullptr; +static utf8* _openrct2DataPath = nullptr; static utf8* _rct1DataPath = nullptr; static utf8* _rct2DataPath = nullptr; static bool _silentBreakpad = false; @@ -62,22 +62,22 @@ static bool _silentBreakpad = false; // clang-format off static constexpr const CommandLineOptionDefinition StandardOptions[] { - { CMDLINE_TYPE_SWITCH, &_help, 'h', "help", "show this help message and exit" }, - { CMDLINE_TYPE_SWITCH, &_version, 'v', "version", "show version information and exit" }, - { CMDLINE_TYPE_SWITCH, &_noInstall, 'n', "no-install", "do not install scenario if passed" }, - { CMDLINE_TYPE_SWITCH, &_all, 'a', "all", "show help for all commands" }, - { CMDLINE_TYPE_SWITCH, &_about, NAC, "about", "show information about " OPENRCT2_NAME }, - { CMDLINE_TYPE_SWITCH, &_verbose, NAC, "verbose", "log verbose messages" }, - { CMDLINE_TYPE_SWITCH, &_headless, NAC, "headless", "run " OPENRCT2_NAME " headless" IMPLIES_SILENT_BREAKPAD }, -#ifndef DISABLE_NETWORK - { CMDLINE_TYPE_INTEGER, &_port, NAC, "port", "port to use for hosting or joining a server" }, - { CMDLINE_TYPE_STRING, &_address, NAC, "address", "address to listen on when hosting a server" }, -#endif - { CMDLINE_TYPE_STRING, &_password, NAC, "password", "password needed to join the server" }, - { CMDLINE_TYPE_STRING, &_userDataPath, NAC, "user-data-path", "path to the user data directory (containing config.ini)" }, - { CMDLINE_TYPE_STRING, &_openrctDataPath, NAC, "openrct-data-path", "path to the OpenRCT2 data directory (containing languages)" }, - { CMDLINE_TYPE_STRING, &_rct1DataPath, NAC, "rct1-data-path", "path to the RollerCoaster Tycoon 1 data directory (containing data/csg1.dat)" }, - { CMDLINE_TYPE_STRING, &_rct2DataPath, NAC, "rct2-data-path", "path to the RollerCoaster Tycoon 2 data directory (containing data/g1.dat)" }, + { CMDLINE_TYPE_SWITCH, &_help, 'h', "help", "show this help message and exit" }, + { CMDLINE_TYPE_SWITCH, &_version, 'v', "version", "show version information and exit" }, + { CMDLINE_TYPE_SWITCH, &_noInstall, 'n', "no-install", "do not install scenario if passed" }, + { CMDLINE_TYPE_SWITCH, &_all, 'a', "all", "show help for all commands" }, + { CMDLINE_TYPE_SWITCH, &_about, NAC, "about", "show information about " OPENRCT2_NAME }, + { CMDLINE_TYPE_SWITCH, &_verbose, NAC, "verbose", "log verbose messages" }, + { CMDLINE_TYPE_SWITCH, &_headless, NAC, "headless", "run " OPENRCT2_NAME " headless" IMPLIES_SILENT_BREAKPAD }, +#ifndef DISABLE_NETWORK + { CMDLINE_TYPE_INTEGER, &_port, NAC, "port", "port to use for hosting or joining a server" }, + { CMDLINE_TYPE_STRING, &_address, NAC, "address", "address to listen on when hosting a server" }, +#endif + { CMDLINE_TYPE_STRING, &_password, NAC, "password", "password needed to join the server" }, + { CMDLINE_TYPE_STRING, &_userDataPath, NAC, "user-data-path", "path to the user data directory (containing config.ini)" }, + { CMDLINE_TYPE_STRING, &_openrct2DataPath, NAC, "openrct2-data-path", "path to the OpenRCT2 data directory (containing languages)" }, + { CMDLINE_TYPE_STRING, &_rct1DataPath, NAC, "rct1-data-path", "path to the RollerCoaster Tycoon 1 data directory (containing data/csg1.dat)" }, + { CMDLINE_TYPE_STRING, &_rct2DataPath, NAC, "rct2-data-path", "path to the RollerCoaster Tycoon 2 data directory (containing data/g1.dat)" }, #ifdef USE_BREAKPAD { CMDLINE_TYPE_SWITCH, &_silentBreakpad, NAC, "silent-breakpad", "make breakpad crash reporting silent" }, #endif // USE_BREAKPAD @@ -204,12 +204,12 @@ exitcode_t CommandLine::HandleCommandDefault() Memory::Free(_userDataPath); } - if (_openrctDataPath != nullptr) + if (_openrct2DataPath != nullptr) { utf8 absolutePath[MAX_PATH]{}; - Path::GetAbsolute(absolutePath, std::size(absolutePath), _openrctDataPath); - String::Set(gCustomOpenrctDataPath, std::size(gCustomOpenrctDataPath), absolutePath); - Memory::Free(_openrctDataPath); + Path::GetAbsolute(absolutePath, std::size(absolutePath), _openrct2DataPath); + String::Set(gCustomOpenRCT2DataPath, std::size(gCustomOpenRCT2DataPath), absolutePath); + Memory::Free(_openrct2DataPath); } if (_rct1DataPath != nullptr) diff --git a/src/openrct2/drawing/Drawing.Sprite.cpp b/src/openrct2/drawing/Drawing.Sprite.cpp index 072421964c..f61191aaee 100644 --- a/src/openrct2/drawing/Drawing.Sprite.cpp +++ b/src/openrct2/drawing/Drawing.Sprite.cpp @@ -264,7 +264,7 @@ bool gfx_load_g2() char path[MAX_PATH]; - platform_get_openrct_data_path(path, sizeof(path)); + platform_get_openrct2_data_path(path, sizeof(path)); safe_strcat_path(path, "g2.dat", MAX_PATH); try { diff --git a/src/openrct2/localisation/Date.h b/src/openrct2/localisation/Date.h index 52eb12a1ed..c5812524c9 100644 --- a/src/openrct2/localisation/Date.h +++ b/src/openrct2/localisation/Date.h @@ -36,7 +36,7 @@ enum DATE_FORMAT_YEAR_DAY_MONTH }; -struct openrct_timeofday +struct openrct2_timeofday { uint8_t second; uint8_t minute; @@ -50,7 +50,7 @@ extern const rct_string_id DateFormatStringFormatIds[]; extern uint16_t gDateMonthTicks; extern uint16_t gDateMonthsElapsed; -extern openrct_timeofday gRealTimeOfDay; +extern openrct2_timeofday gRealTimeOfDay; int32_t date_get_month(int32_t months); int32_t date_get_year(int32_t months); diff --git a/src/openrct2/localisation/Localisation.Date.cpp b/src/openrct2/localisation/Localisation.Date.cpp index e1c78968e7..fb4dc26c6b 100644 --- a/src/openrct2/localisation/Localisation.Date.cpp +++ b/src/openrct2/localisation/Localisation.Date.cpp @@ -36,7 +36,7 @@ const rct_string_id DateFormatStringFormatIds[] = { }; // clang-format on -openrct_timeofday gRealTimeOfDay; +openrct2_timeofday gRealTimeOfDay; int32_t date_get_month(int32_t months) { diff --git a/src/openrct2/platform/Platform.Linux.cpp b/src/openrct2/platform/Platform.Linux.cpp index 0e1488bf29..2ca7fa1afd 100644 --- a/src/openrct2/platform/Platform.Linux.cpp +++ b/src/openrct2/platform/Platform.Linux.cpp @@ -81,7 +81,7 @@ namespace Platform std::string GetInstallPath() { // 1. Try command line argument - auto path = std::string(gCustomOpenrctDataPath); + auto path = std::string(gCustomOpenRCT2DataPath); if (!path.empty()) { return Path::GetAbsolute(path); diff --git a/src/openrct2/platform/Platform.Win32.cpp b/src/openrct2/platform/Platform.Win32.cpp index 358b38e616..789b63f171 100644 --- a/src/openrct2/platform/Platform.Win32.cpp +++ b/src/openrct2/platform/Platform.Win32.cpp @@ -145,7 +145,7 @@ namespace Platform std::string GetInstallPath() { - auto path = std::string(gCustomOpenrctDataPath); + auto path = std::string(gCustomOpenRCT2DataPath); if (!path.empty()) { path = Path::GetAbsolute(path); diff --git a/src/openrct2/platform/Platform.macOS.mm b/src/openrct2/platform/Platform.macOS.mm index 807d080502..1f3d2fbbd4 100644 --- a/src/openrct2/platform/Platform.macOS.mm +++ b/src/openrct2/platform/Platform.macOS.mm @@ -66,7 +66,7 @@ namespace Platform std::string GetInstallPath() { - auto path = std::string(gCustomOpenrctDataPath); + auto path = std::string(gCustomOpenRCT2DataPath); if (!path.empty()) { path = Path::GetAbsolute(path); diff --git a/src/openrct2/platform/macos.mm b/src/openrct2/platform/macos.mm index b700b393ab..4a27899ff8 100644 --- a/src/openrct2/platform/macos.mm +++ b/src/openrct2/platform/macos.mm @@ -139,7 +139,7 @@ uint8_t platform_get_locale_measurement_format() void platform_get_changelog_path(utf8* outPath, size_t outSize) { - platform_get_openrct_data_path(outPath, outSize); + platform_get_openrct2_data_path(outPath, outSize); safe_strcat_path(outPath, "changelog.txt", outSize); } diff --git a/src/openrct2/platform/platform.h b/src/openrct2/platform/platform.h index b9a227b1d4..619409d07e 100644 --- a/src/openrct2/platform/platform.h +++ b/src/openrct2/platform/platform.h @@ -110,7 +110,7 @@ bool platform_file_move(const utf8* srcPath, const utf8* dstPath); bool platform_file_delete(const utf8* path); uint32_t platform_get_ticks(); void platform_sleep(uint32_t ms); -void platform_get_openrct_data_path(utf8* outPath, size_t outSize); +void platform_get_openrct2_data_path(utf8* outPath, size_t outSize); void platform_get_user_directory(utf8* outPath, const utf8* subDirectory, size_t outSize); std::string platform_get_username(); bool platform_open_common_file_dialog(utf8* outFilename, file_dialog_desc* desc, size_t outSize); @@ -156,7 +156,7 @@ void platform_remove_file_associations(); bool platform_setup_uri_protocol(); // This function cannot be marked as 'static', even though it may seem to be, // as it requires external linkage, which 'static' prevents -__declspec(dllexport) int32_t StartOpenRCT(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int32_t nCmdShow); +__declspec(dllexport) int32_t StartOpenRCT2(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int32_t nCmdShow); #endif // _WIN32 #ifdef __ANDROID__ diff --git a/test/testpaint/main.cpp b/test/testpaint/main.cpp index 46e5e1f68d..0f873a031d 100644 --- a/test/testpaint/main.cpp +++ b/test/testpaint/main.cpp @@ -273,7 +273,7 @@ BOOL APIENTRY DllMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved) return TRUE; } -__declspec(dllexport) int StartOpenRCT(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) +__declspec(dllexport) int StartOpenRCT2(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { if (_dllModule == nullptr) {