mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-28 09:14:58 +01:00
Part of #22596: Only apply .parkpatch when starting scenarios
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -193,7 +193,10 @@ namespace OpenRCT2::RCT1
|
||||
ImportScenarioObjective(gameState);
|
||||
ImportSavedView(gameState);
|
||||
|
||||
RCT12::FetchAndApplyScenarioPatch(_s4Path, _isScenario);
|
||||
if (_isScenario)
|
||||
{
|
||||
RCT12::FetchAndApplyScenarioPatch(_s4Path);
|
||||
}
|
||||
FixNextGuestNumber(gameState);
|
||||
CountBlockSections();
|
||||
SetDefaultNames();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user