diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 32a5429977..5417294eaf 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -34,6 +34,7 @@ - Fix: [#15377] Entrance/exit ghost doesn't work on different stations without touching them first. - Fix: [#15476] Crash when placing/clearing small scenery. - Fix: [#15487] Map animations do not work correctly when loading an exported SV6 file in vanilla RCT2. +- Fix: [#15490] Tile inspector needlessly updates clearance height when changing surface slopes. - Fix: [#15496] Crash in paint_swinging_inverter_ship_structure(). - Fix: [#15503] Freeze when doing specific coaster merges with block brakes. - Fix: [#15514] Two different “quit to menu” menu items are available in track designer and track design manager. diff --git a/src/openrct2-ui/windows/EditorInventionsList.cpp b/src/openrct2-ui/windows/EditorInventionsList.cpp index 8b8eefafcb..da3e0e5af9 100644 --- a/src/openrct2-ui/windows/EditorInventionsList.cpp +++ b/src/openrct2-ui/windows/EditorInventionsList.cpp @@ -155,7 +155,7 @@ static void move_research_item(ResearchItem* beforeItem, int32_t scrollIndex) w->Invalidate(); } - research_remove(&_editorInventionsListDraggedItem); + ResearchRemove(_editorInventionsListDraggedItem); auto& researchList = scrollIndex == 0 ? gResearchItemsInvented : gResearchItemsUninvented; if (beforeItem != nullptr) diff --git a/src/openrct2/EditorObjectSelectionSession.cpp b/src/openrct2/EditorObjectSelectionSession.cpp index 1ab5c0f0da..36d967310e 100644 --- a/src/openrct2/EditorObjectSelectionSession.cpp +++ b/src/openrct2/EditorObjectSelectionSession.cpp @@ -346,7 +346,7 @@ static void remove_selected_objects_from_research(const ObjectEntryDescriptor& d tmp.type = Research::EntryType::Ride; tmp.entryIndex = entryIndex; tmp.baseRideType = rideType; - research_remove(&tmp); + ResearchRemove(tmp); } break; } @@ -355,7 +355,7 @@ static void remove_selected_objects_from_research(const ObjectEntryDescriptor& d ResearchItem tmp = {}; tmp.type = Research::EntryType::Scenery; tmp.entryIndex = entryIndex; - research_remove(&tmp); + ResearchRemove(tmp); break; } default: diff --git a/src/openrct2/management/Research.cpp b/src/openrct2/management/Research.cpp index d7ed898b32..e28e0f67e0 100644 --- a/src/openrct2/management/Research.cpp +++ b/src/openrct2/management/Research.cpp @@ -421,12 +421,12 @@ static void research_insert_researched(ResearchItem&& item) * * rct2: 0x006857CF */ -void research_remove(ResearchItem* researchItem) +void ResearchRemove(const ResearchItem& researchItem) { for (auto it = gResearchItemsUninvented.begin(); it != gResearchItemsUninvented.end(); it++) { auto& researchItem2 = *it; - if (researchItem2 == *researchItem) + if (researchItem2 == researchItem) { gResearchItemsUninvented.erase(it); return; @@ -435,7 +435,7 @@ void research_remove(ResearchItem* researchItem) for (auto it = gResearchItemsInvented.begin(); it != gResearchItemsInvented.end(); it++) { auto& researchItem2 = *it; - if (researchItem2 == *researchItem) + if (researchItem2 == researchItem) { gResearchItemsInvented.erase(it); return; diff --git a/src/openrct2/management/Research.h b/src/openrct2/management/Research.h index ba0560a031..3271eef7fc 100644 --- a/src/openrct2/management/Research.h +++ b/src/openrct2/management/Research.h @@ -176,7 +176,7 @@ void research_populate_list_random(); void research_finish_item(ResearchItem* researchItem); void research_insert(ResearchItem&& item, bool researched); -void research_remove(ResearchItem* researchItem); +void ResearchRemove(const ResearchItem& researchItem); bool research_insert_ride_entry(uint8_t rideType, ObjectEntryIndex entryIndex, ResearchCategory category, bool researched); void research_insert_ride_entry(ObjectEntryIndex entryIndex, bool researched); diff --git a/src/openrct2/ride/TrackDesign.cpp b/src/openrct2/ride/TrackDesign.cpp index 55317043d2..396b1bab94 100644 --- a/src/openrct2/ride/TrackDesign.cpp +++ b/src/openrct2/ride/TrackDesign.cpp @@ -651,7 +651,7 @@ static void track_design_load_scenery_objects(TrackDesign* td6) { if (scenery.scenery_object.HasValue()) { - objectManager.LoadObject(td6->vehicle_object); + objectManager.LoadObject(scenery.scenery_object); } } } diff --git a/src/openrct2/world/TileInspector.cpp b/src/openrct2/world/TileInspector.cpp index e4b16617d8..868d9915b1 100644 --- a/src/openrct2/world/TileInspector.cpp +++ b/src/openrct2/world/TileInspector.cpp @@ -544,49 +544,37 @@ namespace OpenRCT2::TileInspector if (isExecuting) { const uint8_t originalSlope = surfaceElement->GetSlope(); - const bool diagonal = (originalSlope & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT) >> 4; - uint8_t newSlope = surfaceElement->GetSlope() ^ (1 << cornerIndex); - surfaceElement->SetSlope(newSlope); - if (surfaceElement->GetSlope() & TILE_ELEMENT_SLOPE_ALL_CORNERS_UP) - { - surfaceElement->clearance_height = surfaceElement->base_height + 2; - } - else - { - surfaceElement->clearance_height = surfaceElement->base_height; - } // All corners are raised - if ((surfaceElement->GetSlope() & TILE_ELEMENT_SLOPE_ALL_CORNERS_UP) == TILE_ELEMENT_SLOPE_ALL_CORNERS_UP) + if ((newSlope & TILE_ELEMENT_SLOPE_ALL_CORNERS_UP) == TILE_ELEMENT_SLOPE_ALL_CORNERS_UP) { - uint8_t slope = TILE_ELEMENT_SLOPE_FLAT; - - if (diagonal) + newSlope = TILE_ELEMENT_SLOPE_FLAT; + if ((originalSlope & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT) != 0) { switch (originalSlope & TILE_ELEMENT_SLOPE_ALL_CORNERS_UP) { case TILE_ELEMENT_SLOPE_S_CORNER_DN: - slope |= TILE_ELEMENT_SLOPE_N_CORNER_UP; + newSlope |= TILE_ELEMENT_SLOPE_N_CORNER_UP; break; case TILE_ELEMENT_SLOPE_W_CORNER_DN: - slope |= TILE_ELEMENT_SLOPE_E_CORNER_UP; + newSlope |= TILE_ELEMENT_SLOPE_E_CORNER_UP; break; case TILE_ELEMENT_SLOPE_N_CORNER_DN: - slope |= TILE_ELEMENT_SLOPE_S_CORNER_UP; + newSlope |= TILE_ELEMENT_SLOPE_S_CORNER_UP; break; case TILE_ELEMENT_SLOPE_E_CORNER_DN: - slope |= TILE_ELEMENT_SLOPE_W_CORNER_UP; + newSlope |= TILE_ELEMENT_SLOPE_W_CORNER_UP; break; } } - surfaceElement->SetSlope(slope); - // Update base and clearance heights surfaceElement->base_height += 2; - surfaceElement->clearance_height = surfaceElement->base_height + (diagonal ? 2 : 0); + surfaceElement->clearance_height = surfaceElement->base_height; } + surfaceElement->SetSlope(newSlope); + map_invalidate_tile_full(loc); if (auto* inspector = GetTileInspectorWithPos(loc); inspector != nullptr) @@ -610,18 +598,6 @@ namespace OpenRCT2::TileInspector { uint8_t newSlope = surfaceElement->GetSlope() ^ TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT; surfaceElement->SetSlope(newSlope); - if (surfaceElement->GetSlope() & TILE_ELEMENT_SLOPE_DOUBLE_HEIGHT) - { - surfaceElement->clearance_height = surfaceElement->base_height + 4; - } - else if (surfaceElement->GetSlope() & TILE_ELEMENT_SLOPE_ALL_CORNERS_UP) - { - surfaceElement->clearance_height = surfaceElement->base_height + 2; - } - else - { - surfaceElement->clearance_height = surfaceElement->base_height; - } map_invalidate_tile_full(loc);