From ad2698df0da6efbd31c2a46f943499401369ebee Mon Sep 17 00:00:00 2001 From: Gymnasiast Date: Sun, 20 Jan 2019 12:26:57 +0100 Subject: [PATCH] Move 'should draw path over supports' to tile element --- src/openrct2/paint/tile_element/Paint.Path.cpp | 6 +++--- src/openrct2/world/Footpath.cpp | 10 ++++++++++ src/openrct2/world/TileElement.h | 3 +++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/openrct2/paint/tile_element/Paint.Path.cpp b/src/openrct2/paint/tile_element/Paint.Path.cpp index 7890ea098f..4d7cacb68b 100644 --- a/src/openrct2/paint/tile_element/Paint.Path.cpp +++ b/src/openrct2/paint/tile_element/Paint.Path.cpp @@ -488,7 +488,7 @@ static void sub_6A4101( uint32_t drawnEdges = connectedEdges; // If the path is not drawn over the supports, then no corner sprites will be drawn (making double-width paths // look like connected series of intersections). - if (!(railingEntry->flags & RAILING_ENTRY_FLAG_DRAW_PATH_OVER_SUPPORTS)) + if (!tile_element->AsPath()->ShouldDrawPathOverSupports()) { drawnEdges &= FOOTPATH_PROPERTIES_EDGES_EDGES_MASK; } @@ -1062,7 +1062,7 @@ void path_paint_box_support( height + boundingBoxZOffset); // TODO: Revert this when path import works correctly. - if (!pathElement->IsQueue() && !(railingEntry->flags & RAILING_ENTRY_FLAG_DRAW_PATH_OVER_SUPPORTS)) + if (!pathElement->IsQueue() && !pathElement->ShouldDrawPathOverSupports()) { // don't draw } @@ -1217,7 +1217,7 @@ void path_paint_pole_support( boundBoxOffset.y, height + boundingBoxZOffset); // TODO: Revert this when path import works correctly. - if (pathElement->IsQueue() || (railingEntry->flags & RAILING_ENTRY_FLAG_DRAW_PATH_OVER_SUPPORTS)) + if (pathElement->IsQueue() || pathElement->ShouldDrawPathOverSupports()) { sub_98199C( session, imageId | imageFlags, 0, 0, boundBoxSize.x, boundBoxSize.y, 0, height, boundBoxOffset.x, diff --git a/src/openrct2/world/Footpath.cpp b/src/openrct2/world/Footpath.cpp index eed9ab5b8e..9b56365eee 100644 --- a/src/openrct2/world/Footpath.cpp +++ b/src/openrct2/world/Footpath.cpp @@ -2135,6 +2135,16 @@ void PathElement::SetQueueBannerDirection(uint8_t direction) type |= (direction << 6); } +bool PathElement::ShouldDrawPathOverSupports() +{ + return (GetRailingEntry()->flags & RAILING_ENTRY_FLAG_DRAW_PATH_OVER_SUPPORTS); +} + +void PathElement::SetShouldDrawPathOverSupports(bool on) +{ + log_verbose("Setting 'draw path over supports' to %d", (size_t)on); +} + /** * * rct2: 0x006A8B12 diff --git a/src/openrct2/world/TileElement.h b/src/openrct2/world/TileElement.h index 7259e98d9c..990a7e75df 100644 --- a/src/openrct2/world/TileElement.h +++ b/src/openrct2/world/TileElement.h @@ -228,6 +228,9 @@ public: void SetAdditionStatus(uint8_t newStatus); uint8_t GetRCT1PathType() const; + + bool ShouldDrawPathOverSupports(); + void SetShouldDrawPathOverSupports(bool on); }; assert_struct_size(PathElement, 8);