From 864de57877773bda0d1b96714faae082df635849 Mon Sep 17 00:00:00 2001 From: Michael Steenbeek Date: Sun, 1 Aug 2021 17:26:43 +0200 Subject: [PATCH] Fix #14667: Unpurchaseable land tiles in Extreme Hawaiian Island --- distribution/changelog.txt | 1 + src/openrct2/rct2/S6Importer.cpp | 35 ++++++++++++++++++++++++++++++-- src/openrct2/world/Map.cpp | 5 ++++- src/openrct2/world/Map.h | 3 ++- 4 files changed, 40 insertions(+), 4 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index d30b662143..bfcd3d25e8 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -3,6 +3,7 @@ - Feature: [#15084] [Plugin] Add "vehicle.crash" hook - Feature: [#15143] Added a shortcut key for Giant Screenshot. - Fix: [#14316] Closing the Track Designs Manager window causes broken state. +- Fix: [#14667] “Extreme Hawaiian Island” has unpurchaseable land tiles (original bug). - Fix: [#15096] Crash when placing entrances in the scenario editor near the map corner. - Fix: [#15142] ToonTowner's mine roofs were moved into the pirate theme scenery group instead of the mine theme scenery group. - Fix: [#15148] Track Designs Manager delete confirmation window doesn't display properly. diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index a7cbeb9458..adfd8c04f4 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -472,6 +472,12 @@ public: auto& park = OpenRCT2::GetContext()->GetGameState()->GetPark(); park.Name = GetUserString(_s6.park_name); + FixLandOwnership(); + + research_determine_first_of_type(); + } + void FixLandOwnership() const + { if (String::Equals(_s6.scenario_filename, "Europe - European Cultural Festival.SC6")) { // This scenario breaks pathfinding. Create passages between the worlds. (List is grouped by neighbouring tiles.) @@ -486,8 +492,33 @@ public: OWNERSHIP_OWNED); // clang-format on } - - research_determine_first_of_type(); + else if (String::Equals(gScenarioFileName, "N America - Extreme Hawaiian Island.SC6")) + { + FixLandOwnershipTilesWithOwnership( + { + { 132, 124 }, + { 133, 124 }, + { 133, 125 }, + { 133, 126 }, + { 119, 35 }, + { 132, 62 }, + { 133, 67 }, + { 136, 71 }, + { 87, 33 }, + { 87, 34 }, + { 90, 36 }, + { 91, 36 }, + }, + OWNERSHIP_OWNED); + // We set the doNotDowngrade flag for cases where the player has used a cheat to own all land. + FixLandOwnershipTilesWithOwnership( + { + { 49, 99 }, + { 50, 99 }, + { 88, 110 }, + }, + OWNERSHIP_AVAILABLE, true); + } } void ImportRides() diff --git a/src/openrct2/world/Map.cpp b/src/openrct2/world/Map.cpp index 875484769e..8500825095 100644 --- a/src/openrct2/world/Map.cpp +++ b/src/openrct2/world/Map.cpp @@ -2494,13 +2494,16 @@ void FixLandOwnershipTiles(std::initializer_list tiles) FixLandOwnershipTilesWithOwnership(tiles, OWNERSHIP_AVAILABLE); } -void FixLandOwnershipTilesWithOwnership(std::initializer_list tiles, uint8_t ownership) +void FixLandOwnershipTilesWithOwnership(std::initializer_list tiles, uint8_t ownership, bool doNotDowngrade) { for (const TileCoordsXY* tile = tiles.begin(); tile != tiles.end(); ++tile) { auto surfaceElement = map_get_surface_element_at(tile->ToCoordsXY()); if (surfaceElement != nullptr) { + if (doNotDowngrade && surfaceElement->GetOwnership() == OWNERSHIP_OWNED) + continue; + surfaceElement->SetOwnership(ownership); update_park_fences_around_tile({ (*tile).x * 32, (*tile).y * 32 }); } diff --git a/src/openrct2/world/Map.h b/src/openrct2/world/Map.h index ec2ff4f335..9fae19b987 100644 --- a/src/openrct2/world/Map.h +++ b/src/openrct2/world/Map.h @@ -300,6 +300,7 @@ void map_obstruction_set_error_text(TileElement* tileElement, GameActions::Resul uint16_t check_max_allowable_land_rights_for_tile(const CoordsXYZ& tileMapPos); void FixLandOwnershipTiles(std::initializer_list tiles); -void FixLandOwnershipTilesWithOwnership(std::initializer_list tiles, uint8_t ownership); +void FixLandOwnershipTilesWithOwnership( + std::initializer_list tiles, uint8_t ownership, bool doNotDowngrade = false); #endif