diff --git a/distribution/changelog.txt b/distribution/changelog.txt index d8b5bbfefe..42d497dfee 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -1,6 +1,7 @@ 0.4.15 (in development) ------------------------------------------------------------------------ - Feature: [#15642] Track design placement can now use contruction modifier keys (ctrl/shift). +- Change: [#22596] Land ownership fixes described by .parkpatch files are now only considered on scenarios. - Fix: [#2614] The colour tab of the ride window does not hide invisible cars (original bug). - Fix: [#21959] “Save this before...?” message does not appear when selecting “New Game”. - Fix: [#22231] Invalid object version can cause a crash. diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 30a1c1fc07..fa02a19652 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -193,7 +193,10 @@ namespace OpenRCT2::RCT1 ImportScenarioObjective(gameState); ImportSavedView(gameState); - RCT12::FetchAndApplyScenarioPatch(_s4Path, _isScenario); + if (_isScenario) + { + RCT12::FetchAndApplyScenarioPatch(_s4Path); + } FixNextGuestNumber(gameState); CountBlockSections(); SetDefaultNames(); diff --git a/src/openrct2/rct12/ScenarioPatcher.cpp b/src/openrct2/rct12/ScenarioPatcher.cpp index 2b5c82c9e3..feb38abf10 100644 --- a/src/openrct2/rct12/ScenarioPatcher.cpp +++ b/src/openrct2/rct12/ScenarioPatcher.cpp @@ -457,7 +457,7 @@ static bool ValidateSHA256(const json_t& scenarioPatch, u8string_view scenarioHa return scenarioSHA == scenarioHash; } -void OpenRCT2::RCT12::ApplyScenarioPatch(u8string_view scenarioPatchFile, u8string scenarioSHA, bool isScenario) +void OpenRCT2::RCT12::ApplyScenarioPatch(u8string_view scenarioPatchFile, u8string scenarioSHA) { auto scenarioPatch = OpenRCT2::Json::ReadFromFile(scenarioPatchFile); if (!ValidateSHA256(scenarioPatch, scenarioSHA)) @@ -465,17 +465,13 @@ void OpenRCT2::RCT12::ApplyScenarioPatch(u8string_view scenarioPatchFile, u8stri OpenRCT2::Guard::Assert(0, "Invalid full SHA256. Check for shortened SHA collision"); return; } - // TODO: Land ownership is applied even when loading saved scenario. Should it? ApplyLandOwnershipFixes(scenarioPatch); - if (isScenario) - { - ApplyWaterFixes(scenarioPatch); - ApplyTileFixes(scenarioPatch); - ApplyRideFixes(scenarioPatch); - } + ApplyWaterFixes(scenarioPatch); + ApplyTileFixes(scenarioPatch); + ApplyRideFixes(scenarioPatch); } -void OpenRCT2::RCT12::FetchAndApplyScenarioPatch(u8string_view scenarioPath, bool isScenario) +void OpenRCT2::RCT12::FetchAndApplyScenarioPatch(u8string_view scenarioPath) { if (scenarioPath.empty()) { @@ -486,7 +482,7 @@ void OpenRCT2::RCT12::FetchAndApplyScenarioPatch(u8string_view scenarioPath, boo auto patchPath = GetPatchFileName(scenarioSHA); if (OpenRCT2::File::Exists(patchPath)) { - ApplyScenarioPatch(patchPath, scenarioSHA, isScenario); + ApplyScenarioPatch(patchPath, scenarioSHA); } } diff --git a/src/openrct2/rct12/ScenarioPatcher.h b/src/openrct2/rct12/ScenarioPatcher.h index 42f8a8aed8..49fd2271d2 100644 --- a/src/openrct2/rct12/ScenarioPatcher.h +++ b/src/openrct2/rct12/ScenarioPatcher.h @@ -13,8 +13,8 @@ namespace OpenRCT2::RCT12 { - void FetchAndApplyScenarioPatch(u8string_view scenarioPath, bool isScenario); - void ApplyScenarioPatch(u8string_view scenarioPatchFile, u8string scenarioSHA, bool isScenario); + void FetchAndApplyScenarioPatch(u8string_view scenarioPath); + void ApplyScenarioPatch(u8string_view scenarioPatchFile, u8string scenarioSHA); /*SetDryRun should be used only for testing*/ void SetDryRun(bool enable); } // namespace OpenRCT2::RCT12 diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index a6e6ba6ed5..4c5b2eef5a 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -578,7 +578,10 @@ namespace OpenRCT2::RCT2 gameState.Park.Name = GetUserString(_s6.ParkName); - OpenRCT2::RCT12::FetchAndApplyScenarioPatch(_s6Path, _isScenario); + if (_isScenario) + { + OpenRCT2::RCT12::FetchAndApplyScenarioPatch(_s6Path); + } ResearchDetermineFirstOfType(); UpdateConsolidatedPatrolAreas(); diff --git a/test/tests/ScenarioPatcherTests.cpp b/test/tests/ScenarioPatcherTests.cpp index 30881f7d48..82ccbb3c3c 100644 --- a/test/tests/ScenarioPatcherTests.cpp +++ b/test/tests/ScenarioPatcherTests.cpp @@ -42,7 +42,7 @@ TEST(FetchAndApplyScenarioPatch, expected_json_format) auto path = entry.path().u8string(); if (OpenRCT2::String::EndsWith(path, ".parkpatch")) { - OpenRCT2::RCT12::ApplyScenarioPatch(path, dummySHA, true); + OpenRCT2::RCT12::ApplyScenarioPatch(path, dummySHA); } } SUCCEED();