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:
@@ -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)
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user