From 50f16b6600d6a9821e770e7e2746a89e8958ec93 Mon Sep 17 00:00:00 2001 From: rwjuk Date: Wed, 27 Dec 2017 17:51:55 +0000 Subject: [PATCH] Fix #6388: Con. rights wrongly shown as available on some RCT1 parks I am an idiot --- distribution/changelog.txt | 1 + src/openrct2/world/map.c | 25 ++++++++++++++++++------- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index a07fb8d584..15ec5dfbb6 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -68,6 +68,7 @@ - Fix: [#6331] Scenery costs nothing in track designs. - Fix: [#6360] Off-by-one filenames when exporting all sprites. - Fix: [#6358] HTTP requests can point to invalid URL string. +- Fix: [#6388] Construction rights tool erroneously enabled in some RCT1 scenarios even when no rights available. - Fix: [#6413] Maze previews only showing scenery. - Fix: [#6423] Importing parks containing names with Polish characters. - Fix: [#6423] Polish characters now correctly drawn when using the sprite font. diff --git a/src/openrct2/world/map.c b/src/openrct2/world/map.c index e41149b58d..6705ea21c1 100644 --- a/src/openrct2/world/map.c +++ b/src/openrct2/world/map.c @@ -434,20 +434,31 @@ void map_count_remaining_land_rights() gLandRemainingOwnershipSales = 0; gLandRemainingConstructionSales = 0; - for (sint32 x = 0; x < MAXIMUM_MAP_SIZE_TECHNICAL; x++) { - for (sint32 y = 0; y < MAXIMUM_MAP_SIZE_TECHNICAL; y++) { + for (sint32 x = 0; x < MAXIMUM_MAP_SIZE_TECHNICAL; x++) + { + for (sint32 y = 0; y < MAXIMUM_MAP_SIZE_TECHNICAL; y++) + { rct_tile_element *element = map_get_surface_element_at(x, y); // Surface elements are sometimes hacked out to save some space for other map elements - if (element == NULL) { + if (element == NULL) + { continue; } uint8 flags = element->properties.surface.ownership; - if ((flags & OWNERSHIP_AVAILABLE) && (flags & OWNERSHIP_OWNED) == 0) { - gLandRemainingOwnershipSales++; - } else if ((flags & OWNERSHIP_CONSTRUCTION_RIGHTS_AVAILABLE) && (flags & OWNERSHIP_CONSTRUCTION_RIGHTS_OWNED) == 0) { - gLandRemainingConstructionSales++; + // Do not combine this condition with (flags & OWNERSHIP_AVAILABLE) + // As some RCT1 parks have owned tiles with the 'construction rights available' flag also set + if (!(flags & OWNERSHIP_OWNED)) + { + if (flags & OWNERSHIP_AVAILABLE) + { + gLandRemainingOwnershipSales++; + } + else if ((flags & OWNERSHIP_CONSTRUCTION_RIGHTS_AVAILABLE) && (flags & OWNERSHIP_CONSTRUCTION_RIGHTS_OWNED) == 0) + { + gLandRemainingConstructionSales++; + } } } }