1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-27 08:45:00 +01:00

Move over switches to normalised tile element types

This commit is contained in:
Gymnasiast
2021-12-11 00:30:59 +01:00
parent bedcba5ea8
commit fc3ce3294c
23 changed files with 386 additions and 381 deletions

View File

@@ -148,14 +148,14 @@ static int32_t tile_element_get_total_element_count(TileElement* tileElement)
int32_t elementCount;
rct_large_scenery_tile* tile;
switch (tileElement->GetType())
switch (tileElement->GetTypeN())
{
case TILE_ELEMENT_TYPE_PATH:
case TILE_ELEMENT_TYPE_SMALL_SCENERY:
case TILE_ELEMENT_TYPE_WALL:
case TileElementTypeN::Path:
case TileElementTypeN::SmallScenery:
case TileElementTypeN::Wall:
return 1;
case TILE_ELEMENT_TYPE_LARGE_SCENERY:
case TileElementTypeN::LargeScenery:
{
auto* sceneryEntry = tileElement->AsLargeScenery()->GetEntry();
tile = sceneryEntry->tiles;
@@ -585,17 +585,17 @@ static void track_design_save_remove_tile_element(
static bool track_design_save_should_select_scenery_around(ride_id_t rideIndex, TileElement* tileElement)
{
switch (tileElement->GetType())
switch (tileElement->GetTypeN())
{
case TILE_ELEMENT_TYPE_PATH:
case TileElementTypeN::Path:
if (tileElement->AsPath()->IsQueue() && tileElement->AsPath()->GetRideIndex() == rideIndex)
return true;
break;
case TILE_ELEMENT_TYPE_TRACK:
case TileElementTypeN::Track:
if (tileElement->AsTrack()->GetRideIndex() == rideIndex)
return true;
break;
case TILE_ELEMENT_TYPE_ENTRANCE:
case TileElementTypeN::Entrance:
// FIXME: This will always break and return false!
if (tileElement->AsEntrance()->GetEntranceType() != ENTRANCE_TYPE_RIDE_ENTRANCE)
break;
@@ -604,6 +604,8 @@ static bool track_design_save_should_select_scenery_around(ride_id_t rideIndex,
if (tileElement->AsEntrance()->GetRideIndex() == rideIndex)
return true;
break;
default:
break;
}
return false;
}
@@ -622,23 +624,25 @@ static void track_design_save_select_nearby_scenery_for_tile(ride_id_t rideIndex
do
{
ViewportInteractionItem interactionType = ViewportInteractionItem::None;
switch (tileElement->GetType())
switch (tileElement->GetTypeN())
{
case TILE_ELEMENT_TYPE_PATH:
case TileElementTypeN::Path:
if (!tileElement->AsPath()->IsQueue())
interactionType = ViewportInteractionItem::Footpath;
else if (tileElement->AsPath()->GetRideIndex() == rideIndex)
interactionType = ViewportInteractionItem::Footpath;
break;
case TILE_ELEMENT_TYPE_SMALL_SCENERY:
case TileElementTypeN::SmallScenery:
interactionType = ViewportInteractionItem::Scenery;
break;
case TILE_ELEMENT_TYPE_WALL:
case TileElementTypeN::Wall:
interactionType = ViewportInteractionItem::Wall;
break;
case TILE_ELEMENT_TYPE_LARGE_SCENERY:
case TileElementTypeN::LargeScenery:
interactionType = ViewportInteractionItem::LargeScenery;
break;
default:
break;
}
if (interactionType != ViewportInteractionItem::None)