Merge pull request #8070 from Gymnasiast/fix/8057

Fix three tile element crashes
This commit is contained in:
Michael Steenbeek 2018-10-09 22:49:20 +02:00 committed by GitHub
commit 12145a34ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 3 deletions

View File

@ -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) if (interactionType != VIEWPORT_INTERACTION_ITEM_RIDE)
return; return;
if (tileElement->GetType() != TILE_ELEMENT_TYPE_TRACK)
return;
if (tileElement->AsTrack()->GetRideIndex() != w->number) if (tileElement->AsTrack()->GetRideIndex() != w->number)
return; return;
if (tileElement->AsTrack()->GetColourScheme() == newColourScheme) if (tileElement->AsTrack()->GetColourScheme() == newColourScheme)

View File

@ -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 // 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; return;
for (int32_t xOffset = -1; xOffset <= 1; xOffset++) for (int32_t xOffset = -1; xOffset <= 1; xOffset++)

View File

@ -3664,10 +3664,10 @@ void map_update_tiles()
interleaved_xy >>= 1; 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) if (tileElement != nullptr)
{ {
tileElement->UpdateGrassLength({ x * 32, y * 32 }); tileElement->AsSurface()->UpdateGrassLength({ x * 32, y * 32 });
scenery_update_tile(x * 32, y * 32); scenery_update_tile(x * 32, y * 32);
} }