diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index fddef51490..5e12aa3a65 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -4273,6 +4273,8 @@ static void window_ride_set_track_colour_scheme(rct_window* w, int32_t x, int32_ if (interactionType != VIEWPORT_INTERACTION_ITEM_RIDE) return; + if (tileElement->GetType() != TILE_ELEMENT_TYPE_TRACK) + return; if (tileElement->AsTrack()->GetRideIndex() != w->number) return; if (tileElement->AsTrack()->GetColourScheme() == newColourScheme) diff --git a/src/openrct2/world/Footpath.cpp b/src/openrct2/world/Footpath.cpp index f7f6fab3eb..ed47ac4563 100644 --- a/src/openrct2/world/Footpath.cpp +++ b/src/openrct2/world/Footpath.cpp @@ -2530,7 +2530,7 @@ static void footpath_fix_corners_around(int32_t x, int32_t y, rct_tile_element* }; // Sloped paths don't create filled corners, so no need to remove any - if (pathElement->AsPath()->IsSloped()) + if (pathElement->GetType() == TILE_ELEMENT_TYPE_PATH && pathElement->AsPath()->IsSloped()) return; for (int32_t xOffset = -1; xOffset <= 1; xOffset++) diff --git a/src/openrct2/world/Map.cpp b/src/openrct2/world/Map.cpp index 90262adea1..aaf0b1c7d1 100644 --- a/src/openrct2/world/Map.cpp +++ b/src/openrct2/world/Map.cpp @@ -3664,10 +3664,10 @@ void map_update_tiles() interleaved_xy >>= 1; } - SurfaceElement* tileElement = map_get_surface_element_at(x, y)->AsSurface(); + rct_tile_element* tileElement = map_get_surface_element_at(x, y); if (tileElement != nullptr) { - tileElement->UpdateGrassLength({ x * 32, y * 32 }); + tileElement->AsSurface()->UpdateGrassLength({ x * 32, y * 32 }); scenery_update_tile(x * 32, y * 32); }