1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-16 19:43:06 +01:00

Part of #22596: Remove "cannot_downgrade" support for .parkpatch

This commit is contained in:
Tulio Leao
2024-09-07 11:04:35 -03:00
parent e1b6ee93f9
commit d73c14e585
3 changed files with 3 additions and 10 deletions

View File

@@ -43,7 +43,6 @@ static const std::string s_fullSHAKey = "sha256";
static const std::string s_coordinatesKey = "coordinates";
// Land Ownership Keys
static const std::string s_cannotDowngradeKey = "cannot_downgrade";
static const std::string s_landOwnershipKey = "land_ownership";
// Water fix keys
@@ -132,15 +131,12 @@ static void ApplyLandOwnershipFixes(const json_t& landOwnershipFixes, int owners
}
auto ownershipParameters = landOwnershipFixes[ownershipTypeKey];
const bool cannotDowngrade = ownershipParameters.contains(s_cannotDowngradeKey)
? OpenRCT2::Json::GetBoolean(ownershipParameters[s_cannotDowngradeKey], false)
: false;
auto coordinatesVector = getCoordinates(ownershipParameters);
if (s_dryRun)
{
return;
}
FixLandOwnershipTilesWithOwnership(coordinatesVector, ownershipType, cannotDowngrade);
FixLandOwnershipTilesWithOwnership(coordinatesVector, ownershipType);
}
static void ApplyLandOwnershipFixes(const json_t& scenarioPatch)

View File

@@ -2159,16 +2159,13 @@ uint16_t CheckMaxAllowableLandRightsForTile(const CoordsXYZ& tileMapPos)
return destOwnership;
}
void FixLandOwnershipTilesWithOwnership(std::vector<TileCoordsXY> tiles, uint8_t ownership, bool doNotDowngrade)
void FixLandOwnershipTilesWithOwnership(std::vector<TileCoordsXY> tiles, uint8_t ownership)
{
for (const auto& tile : tiles)
{
auto surfaceElement = MapGetSurfaceElementAt(tile);
if (surfaceElement != nullptr)
{
if (doNotDowngrade && surfaceElement->GetOwnership() == OWNERSHIP_OWNED)
continue;
surfaceElement->SetOwnership(ownership);
Park::UpdateFencesAroundTile(tile.ToCoordsXY());
}

View File

@@ -235,6 +235,6 @@ bool MapIsLocationAtEdge(const CoordsXY& loc);
uint16_t CheckMaxAllowableLandRightsForTile(const CoordsXYZ& tileMapPos);
void FixLandOwnershipTilesWithOwnership(std::vector<TileCoordsXY> tiles, uint8_t ownership, bool doNotDowngrade = false);
void FixLandOwnershipTilesWithOwnership(std::vector<TileCoordsXY> tiles, uint8_t ownership);
MapRange ClampRangeWithinMap(const MapRange& range);
void ShiftMap(const TileCoordsXY& amount);