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

This commit is contained in:
Tulio Leao committed 2024-09-08 06:52:03 -03:00
1 parent e1b6ee93f9
commit d73c14e585
3 files changed
+3 -10

No files matched your search

+1 -5
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)
+1 -4
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());
}
+1 -1
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);