diff --git a/src/openrct2-ui/interface/ViewportInteraction.cpp b/src/openrct2-ui/interface/ViewportInteraction.cpp index 8d4c587354..8d3cb3d111 100644 --- a/src/openrct2-ui/interface/ViewportInteraction.cpp +++ b/src/openrct2-ui/interface/ViewportInteraction.cpp @@ -243,7 +243,7 @@ int32_t viewport_interaction_get_item_right(int32_t x, int32_t y, viewport_inter if (tileElement->GetType() == TILE_ELEMENT_TYPE_ENTRANCE) { rct_string_id stringId; - if (tileElement->properties.entrance.type == ENTRANCE_TYPE_RIDE_ENTRANCE) + if (tileElement->AsEntrance()->GetEntranceType() == ENTRANCE_TYPE_RIDE_ENTRANCE) { if (ride->num_stations > 1) { diff --git a/src/openrct2-ui/windows/Map.cpp b/src/openrct2-ui/windows/Map.cpp index d0fd9d16e6..2c4551bdc4 100644 --- a/src/openrct2-ui/windows/Map.cpp +++ b/src/openrct2-ui/windows/Map.cpp @@ -1587,7 +1587,7 @@ static uint16_t map_window_get_pixel_colour_ride(CoordsXY c) colourA = MAP_COLOUR(PALETTE_INDEX_14); // lighter grey break; case TILE_ELEMENT_TYPE_ENTRANCE: - if (tileElement->properties.entrance.type == ENTRANCE_TYPE_PARK_ENTRANCE) + if (tileElement->AsEntrance()->GetEntranceType() == ENTRANCE_TYPE_PARK_ENTRANCE) break; // fall-through case TILE_ELEMENT_TYPE_TRACK: diff --git a/src/openrct2-ui/windows/TileInspector.cpp b/src/openrct2-ui/windows/TileInspector.cpp index 0b4ef97058..2fd4e082a9 100644 --- a/src/openrct2-ui/windows/TileInspector.cpp +++ b/src/openrct2-ui/windows/TileInspector.cpp @@ -1608,7 +1608,7 @@ static void window_tile_inspector_invalidate(rct_window* w) w->widgets[WIDX_ENTRANCE_BUTTON_MAKE_USABLE].top = GBBT(propertiesAnchor, 1); w->widgets[WIDX_ENTRANCE_BUTTON_MAKE_USABLE].bottom = GBBB(propertiesAnchor, 1); widget_set_enabled( - w, WIDX_ENTRANCE_BUTTON_MAKE_USABLE, tileElement->properties.entrance.type != ENTRANCE_TYPE_PARK_ENTRANCE); + w, WIDX_ENTRANCE_BUTTON_MAKE_USABLE, tileElement->AsEntrance()->GetEntranceType() != ENTRANCE_TYPE_PARK_ENTRANCE); break; case TILE_INSPECTOR_PAGE_WALL: { @@ -1918,10 +1918,10 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi) { // Details // Entrance type - rct_string_id entranceType = EntranceTypeStringIds[tileElement->properties.entrance.type]; + rct_string_id entranceType = EntranceTypeStringIds[tileElement->AsEntrance()->GetEntranceType()]; gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_ENTRANCE_TYPE, &entranceType, COLOUR_DARK_GREEN, x, y); - if (tileElement->properties.entrance.type == ENTRANCE_TYPE_PARK_ENTRANCE) + if (tileElement->AsEntrance()->GetEntranceType() == ENTRANCE_TYPE_PARK_ENTRANCE) { // Park entrance ID int32_t middleX = windowTileInspectorTileX << 5; @@ -1935,7 +1935,7 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi) { int16_t rideEntranceIndex = (tileElement->properties.entrance.index & 0x30) >> 4; // TODO: use mask or function - if (tileElement->properties.entrance.type == ENTRANCE_TYPE_RIDE_ENTRANCE) + if (tileElement->AsEntrance()->GetEntranceType() == ENTRANCE_TYPE_RIDE_ENTRANCE) { // Ride entrance ID gfx_draw_string_left( @@ -1949,7 +1949,7 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi) } } - if (tileElement->properties.entrance.type == ENTRANCE_TYPE_PARK_ENTRANCE) + if (tileElement->AsEntrance()->GetEntranceType() == ENTRANCE_TYPE_PARK_ENTRANCE) { // Entrance part rct_string_id entrancePart = ParkEntrancePartStringIds[tileElement->properties.entrance.index & 0x0F]; diff --git a/src/openrct2/EditorObjectSelectionSession.cpp b/src/openrct2/EditorObjectSelectionSession.cpp index fd0ec9c1c0..f35bfab3cb 100644 --- a/src/openrct2/EditorObjectSelectionSession.cpp +++ b/src/openrct2/EditorObjectSelectionSession.cpp @@ -148,7 +148,7 @@ void setup_in_use_selection_flags() Editor::SetSelectedObject(OBJECT_TYPE_SMALL_SCENERY, type, OBJECT_SELECTION_FLAG_SELECTED); break; case TILE_ELEMENT_TYPE_ENTRANCE: - if (iter.element->properties.entrance.type != ENTRANCE_TYPE_PARK_ENTRANCE) + if (iter.element->AsEntrance()->GetEntranceType() != ENTRANCE_TYPE_PARK_ENTRANCE) break; // Skip if not the middle part if (iter.element->properties.entrance.index != 0) diff --git a/src/openrct2/actions/PlaceParkEntranceAction.hpp b/src/openrct2/actions/PlaceParkEntranceAction.hpp index c6654fdbb6..9e90f12c12 100644 --- a/src/openrct2/actions/PlaceParkEntranceAction.hpp +++ b/src/openrct2/actions/PlaceParkEntranceAction.hpp @@ -193,7 +193,7 @@ public: newElement->SetType(TILE_ELEMENT_TYPE_ENTRANCE); newElement->SetDirection(_direction); newElement->properties.entrance.index = index; - newElement->properties.entrance.type = ENTRANCE_TYPE_PARK_ENTRANCE; + newElement->AsEntrance()->GetEntranceType() = ENTRANCE_TYPE_PARK_ENTRANCE; newElement->properties.entrance.path_type = gFootpathSelectedId; if (!(flags & GAME_COMMAND_FLAG_GHOST)) diff --git a/src/openrct2/actions/RideDemolishAction.hpp b/src/openrct2/actions/RideDemolishAction.hpp index 4aba6b8e1a..a6bbf9756a 100644 --- a/src/openrct2/actions/RideDemolishAction.hpp +++ b/src/openrct2/actions/RideDemolishAction.hpp @@ -288,7 +288,7 @@ private: if (tile_type == TILE_ELEMENT_TYPE_ENTRANCE) { - uint8_t type = entrance_element_get_type(it.element); + uint8_t type = it.element->AsEntrance()->GetEntranceType(); if (type == ENTRANCE_TYPE_PARK_ENTRANCE) continue; diff --git a/src/openrct2/paint/tile_element/Paint.Entrance.cpp b/src/openrct2/paint/tile_element/Paint.Entrance.cpp index c9d1194245..5a58b409fa 100644 --- a/src/openrct2/paint/tile_element/Paint.Entrance.cpp +++ b/src/openrct2/paint/tile_element/Paint.Entrance.cpp @@ -30,7 +30,7 @@ static uint32_t _unk9E32BC; static void ride_entrance_exit_paint( paint_session* session, uint8_t direction, int32_t height, const rct_tile_element* tile_element) { - uint8_t is_exit = tile_element->properties.entrance.type == ENTRANCE_TYPE_RIDE_EXIT; + uint8_t is_exit = tile_element->AsEntrance()->GetEntranceType() == ENTRANCE_TYPE_RIDE_EXIT; if (gTrackDesignSaveMode || (gCurrentViewportFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES)) { @@ -345,7 +345,7 @@ void entrance_paint(paint_session* session, uint8_t direction, int32_t height, c } } - switch (tile_element->properties.entrance.type) + switch (tile_element->AsEntrance()->GetEntranceType()) { case ENTRANCE_TYPE_RIDE_ENTRANCE: case ENTRANCE_TYPE_RIDE_EXIT: diff --git a/src/openrct2/peep/Guest.cpp b/src/openrct2/peep/Guest.cpp index fd397c9aaa..45cd9f2249 100644 --- a/src/openrct2/peep/Guest.cpp +++ b/src/openrct2/peep/Guest.cpp @@ -4820,7 +4820,7 @@ void rct_peep::UpdateRideMazePathfinding() } if (tileElement->GetType() == TILE_ELEMENT_TYPE_ENTRANCE - && tileElement->properties.entrance.type == ENTRANCE_TYPE_RIDE_EXIT) + && tileElement->AsEntrance()->GetEntranceType() == ENTRANCE_TYPE_RIDE_EXIT) { mazeType = maze_type::entrance_or_exit; break; diff --git a/src/openrct2/peep/GuestPathfinding.cpp b/src/openrct2/peep/GuestPathfinding.cpp index c2ffd16716..49418f0458 100644 --- a/src/openrct2/peep/GuestPathfinding.cpp +++ b/src/openrct2/peep/GuestPathfinding.cpp @@ -313,7 +313,7 @@ static uint8_t footpath_element_dest_in_dir( case TILE_ELEMENT_TYPE_ENTRANCE: if (loc.z != tileElement->base_height) continue; - switch (tileElement->properties.entrance.type) + switch (tileElement->AsEntrance()->GetEntranceType()) { case ENTRANCE_TYPE_RIDE_ENTRANCE: direction = tileElement->GetDirection(); @@ -673,7 +673,7 @@ static void peep_pathfind_heuristic_search( continue; int32_t direction; searchResult = PATH_SEARCH_OTHER; - switch (tileElement->properties.entrance.type) + switch (tileElement->AsEntrance()->GetEntranceType()) { case ENTRANCE_TYPE_RIDE_ENTRANCE: /* For peeps heading for a ride without a queue, the diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index 5687634de6..f8a0c69f8b 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -2429,7 +2429,7 @@ static void peep_return_to_centre_of_tile(rct_peep* peep) static void peep_interact_with_entrance( rct_peep* peep, int16_t x, int16_t y, rct_tile_element* tile_element, uint8_t& pathing_result) { - uint8_t entranceType = tile_element->properties.entrance.type; + uint8_t entranceType = tile_element->AsEntrance()->GetEntranceType(); uint8_t rideIndex = tile_element->properties.entrance.ride_index; // Store some details to determine when to override the default diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 814ae42079..9fc80041cb 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -2536,7 +2536,7 @@ private: break; } case TILE_ELEMENT_TYPE_ENTRANCE: - if (tileElement->properties.entrance.type == ENTRANCE_TYPE_PARK_ENTRANCE) + if (tileElement->AsEntrance()->GetEntranceType() == ENTRANCE_TYPE_PARK_ENTRANCE) { uint8_t pathType = tileElement->properties.entrance.path_type; if (pathType == 0) @@ -2708,7 +2708,7 @@ private: if (element->GetType() != TILE_ELEMENT_TYPE_ENTRANCE) continue; - if (element->properties.entrance.type != ENTRANCE_TYPE_PARK_ENTRANCE) + if (element->AsEntrance()->GetEntranceType() != ENTRANCE_TYPE_PARK_ENTRANCE) continue; if ((element->properties.entrance.index & 0x0F) != 0) continue; diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index d999c6e09e..1617747773 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -1876,7 +1876,7 @@ static int32_t ride_modify_entrance_or_exit(rct_tile_element* tileElement, int32 rideIndex = tileElement->properties.entrance.ride_index; - entranceType = tileElement->properties.entrance.type; + entranceType = tileElement->AsEntrance()->GetEntranceType(); if (entranceType != ENTRANCE_TYPE_RIDE_ENTRANCE && entranceType != ENTRANCE_TYPE_RIDE_EXIT) return 0; @@ -3612,7 +3612,7 @@ static void ride_entrance_set_map_tooltip(rct_tile_element* tileElement) if (ride->station_starts[i].xy == RCT_XY8_UNDEFINED) stationIndex--; - if (tileElement->properties.entrance.type == ENTRANCE_TYPE_RIDE_ENTRANCE) + if (tileElement->AsEntrance()->GetEntranceType() == ENTRANCE_TYPE_RIDE_ENTRANCE) { // Get the queue length int32_t queueLength = 0; @@ -4731,8 +4731,8 @@ static void ride_set_maze_entrance_exit_points(Ride* ride) { if (tileElement->GetType() != TILE_ELEMENT_TYPE_ENTRANCE) continue; - if (tileElement->properties.entrance.type != ENTRANCE_TYPE_RIDE_ENTRANCE - && tileElement->properties.entrance.type != ENTRANCE_TYPE_RIDE_EXIT) + if (tileElement->AsEntrance()->GetEntranceType() != ENTRANCE_TYPE_RIDE_ENTRANCE + && tileElement->AsEntrance()->GetEntranceType() != ENTRANCE_TYPE_RIDE_EXIT) { continue; } @@ -8147,7 +8147,7 @@ void sub_6CB945(int32_t rideIndex) continue; if (tileElement->properties.entrance.ride_index != rideIndex) continue; - if (tileElement->properties.entrance.type > ENTRANCE_TYPE_RIDE_EXIT) + if (tileElement->AsEntrance()->GetEntranceType() > ENTRANCE_TYPE_RIDE_EXIT) continue; CoordsXY nextLocation = location; @@ -8181,7 +8181,7 @@ void sub_6CB945(int32_t rideIndex) stationId = trackElement->AsTrack()->GetStationIndex(); } - if (tileElement->properties.entrance.type == ENTRANCE_TYPE_RIDE_EXIT) + if (tileElement->AsEntrance()->GetEntranceType() == ENTRANCE_TYPE_RIDE_EXIT) { if (!ride_get_exit_location(ride, stationId).isNull()) break; @@ -8863,7 +8863,7 @@ void determine_ride_entrance_and_exit_locations() // The expected height is where entrances and exit reside in non-hacked parks. const uint8_t expectedHeight = ride->station_heights[stationIndex]; - if (fixEntrance && tileElement->properties.entrance.type == ENTRANCE_TYPE_RIDE_ENTRANCE) + if (fixEntrance && tileElement->AsEntrance()->GetEntranceType() == ENTRANCE_TYPE_RIDE_ENTRANCE) { if (alreadyFoundEntrance) { @@ -8887,7 +8887,7 @@ void determine_ride_entrance_and_exit_locations() "Fixed disconnected entrance of ride %d, station %d to x = %d, y = %d and z = %d.", rideIndex, stationIndex, x, y, tileElement->base_height); } - else if (fixExit && tileElement->properties.entrance.type == ENTRANCE_TYPE_RIDE_EXIT) + else if (fixExit && tileElement->AsEntrance()->GetEntranceType() == ENTRANCE_TYPE_RIDE_EXIT) { if (alreadyFoundExit) { diff --git a/src/openrct2/ride/TrackDesignSave.cpp b/src/openrct2/ride/TrackDesignSave.cpp index 07b51b8669..11f7350204 100644 --- a/src/openrct2/ride/TrackDesignSave.cpp +++ b/src/openrct2/ride/TrackDesignSave.cpp @@ -605,9 +605,10 @@ static bool track_design_save_should_select_scenery_around(int32_t rideIndex, rc return true; break; case TILE_ELEMENT_TYPE_ENTRANCE: - if (tileElement->properties.entrance.type != ENTRANCE_TYPE_RIDE_ENTRANCE) + // FIXME: This will always break and return false! + if (tileElement->AsEntrance()->GetEntranceType() != ENTRANCE_TYPE_RIDE_ENTRANCE) break; - if (tileElement->properties.entrance.type != ENTRANCE_TYPE_RIDE_EXIT) + if (tileElement->AsEntrance()->GetEntranceType() != ENTRANCE_TYPE_RIDE_EXIT) break; if (tileElement->properties.entrance.ride_index == rideIndex) return true; @@ -926,7 +927,7 @@ static bool track_design_save_to_td6_for_maze(uint8_t rideIndex, rct_track_td6* { if (tileElement->GetType() != TILE_ELEMENT_TYPE_ENTRANCE) continue; - if (tileElement->properties.entrance.type != ENTRANCE_TYPE_RIDE_ENTRANCE) + if (tileElement->AsEntrance()->GetEntranceType() != ENTRANCE_TYPE_RIDE_ENTRANCE) continue; if (tileElement->properties.entrance.ride_index == rideIndex) break; @@ -956,7 +957,7 @@ static bool track_design_save_to_td6_for_maze(uint8_t rideIndex, rct_track_td6* { if (tileElement->GetType() != TILE_ELEMENT_TYPE_ENTRANCE) continue; - if (tileElement->properties.entrance.type != ENTRANCE_TYPE_RIDE_EXIT) + if (tileElement->AsEntrance()->GetEntranceType() != ENTRANCE_TYPE_RIDE_EXIT) continue; if (tileElement->properties.entrance.ride_index == rideIndex) break; diff --git a/src/openrct2/world/Entrance.cpp b/src/openrct2/world/Entrance.cpp index a7f655c7d7..02b2efa7db 100644 --- a/src/openrct2/world/Entrance.cpp +++ b/src/openrct2/world/Entrance.cpp @@ -267,7 +267,7 @@ static money32 RideEntranceExitPlace( tileElement->SetType(TILE_ELEMENT_TYPE_ENTRANCE); tileElement->SetDirection(direction); tileElement->clearance_height = clear_z; - tileElement->properties.entrance.type = isExit; + tileElement->AsEntrance()->SetEntranceType(isExit ? ENTRANCE_TYPE_RIDE_EXIT : ENTRANCE_TYPE_RIDE_ENTRANCE); tileElement->properties.entrance.index = stationNum << 4; tileElement->properties.entrance.ride_index = rideIndex; @@ -390,7 +390,7 @@ static money32 RideEntranceExitRemove(int16_t x, int16_t y, uint8_t rideIndex, u maze_entrance_hedge_replacement(x, y, tileElement); footpath_remove_edges_at(x, y, tileElement); - bool isExit = tileElement->properties.entrance.type == ENTRANCE_TYPE_RIDE_EXIT; + bool isExit = tileElement->AsEntrance()->GetEntranceType() == ENTRANCE_TYPE_RIDE_EXIT; tile_element_remove(tileElement); @@ -641,3 +641,13 @@ void EntranceElement::SetStationIndex(uint8_t stationIndex) index &= ~MAP_ELEM_TRACK_SEQUENCE_STATION_INDEX_MASK; index |= (stationIndex << 4); } + +uint8_t EntranceElement::GetEntranceType() const +{ + return entranceType; +} + +void EntranceElement::SetEntranceType(uint8_t newType) +{ + entranceType = newType; +} diff --git a/src/openrct2/world/Footpath.cpp b/src/openrct2/world/Footpath.cpp index 613a9a940d..6f37ae0402 100644 --- a/src/openrct2/world/Footpath.cpp +++ b/src/openrct2/world/Footpath.cpp @@ -98,7 +98,7 @@ static constexpr const uint8_t connected_path_count[] = { int32_t entrance_get_directions(const rct_tile_element* tileElement) { - uint8_t entranceType = tileElement->properties.entrance.type; + uint8_t entranceType = tileElement->AsEntrance()->GetEntranceType(); uint8_t sequence = tileElement->properties.entrance.index & 0x0F; return EntranceDirections[(entranceType * 8) + sequence]; } @@ -1401,7 +1401,7 @@ static void loc_6A6D7E( } else { - if (tileElement->properties.entrance.type != ENTRANCE_TYPE_PARK_ENTRANCE) + if (tileElement->AsEntrance()->GetEntranceType() != ENTRANCE_TYPE_PARK_ENTRANCE) { footpath_queue_chain_push(tileElement->properties.entrance.ride_index); } @@ -1753,7 +1753,7 @@ void footpath_update_queue_chains() { if (tileElement->GetType() != TILE_ELEMENT_TYPE_ENTRANCE) continue; - if (tileElement->properties.entrance.type != ENTRANCE_TYPE_RIDE_ENTRANCE) + if (tileElement->AsEntrance()->GetEntranceType() != ENTRANCE_TYPE_RIDE_ENTRANCE) continue; if (tileElement->properties.entrance.ride_index != rideIndex) continue; @@ -2336,7 +2336,7 @@ void footpath_update_queue_entrance_banner(int32_t x, int32_t y, rct_tile_elemen } break; case TILE_ELEMENT_TYPE_ENTRANCE: - if (tileElement->properties.entrance.type == ENTRANCE_TYPE_RIDE_ENTRANCE) + if (tileElement->AsEntrance()->GetEntranceType() == ENTRANCE_TYPE_RIDE_ENTRANCE) { footpath_queue_chain_push(tileElement->properties.entrance.ride_index); footpath_chain_ride_queue(255, 0, x, y, tileElement, tileElement->GetDirectionWithOffset(2)); diff --git a/src/openrct2/world/Map.cpp b/src/openrct2/world/Map.cpp index daf9f1033f..3ed1295dd4 100644 --- a/src/openrct2/world/Map.cpp +++ b/src/openrct2/world/Map.cpp @@ -3144,7 +3144,7 @@ void map_remove_all_rides() } break; case TILE_ELEMENT_TYPE_ENTRANCE: - if (it.element->properties.entrance.type == ENTRANCE_TYPE_PARK_ENTRANCE) + if (it.element->AsEntrance()->GetEntranceType() == ENTRANCE_TYPE_PARK_ENTRANCE) break; // fall-through @@ -3424,7 +3424,7 @@ void map_obstruction_set_error_text(rct_tile_element* tileElement) set_format_arg(0, rct_string_id, sceneryEntry->name); break; case TILE_ELEMENT_TYPE_ENTRANCE: - switch (tileElement->properties.entrance.type) + switch (tileElement->AsEntrance()->GetEntranceType()) { case ENTRANCE_TYPE_RIDE_ENTRANCE: errorStringId = STR_RIDE_ENTRANCE_IN_THE_WAY; @@ -3972,7 +3972,7 @@ rct_tile_element* map_get_park_entrance_element_at(int32_t x, int32_t y, int32_t if (tileElement->base_height != z) continue; - if (tileElement->properties.entrance.type != ENTRANCE_TYPE_PARK_ENTRANCE) + if (tileElement->AsEntrance()->GetEntranceType() != ENTRANCE_TYPE_PARK_ENTRANCE) continue; if ((ghost == false) && (tileElement->flags & TILE_ELEMENT_FLAG_GHOST)) @@ -3997,7 +3997,7 @@ rct_tile_element* map_get_ride_entrance_element_at(int32_t x, int32_t y, int32_t if (tileElement->base_height != z) continue; - if (tileElement->properties.entrance.type != ENTRANCE_TYPE_RIDE_ENTRANCE) + if (tileElement->AsEntrance()->GetEntranceType() != ENTRANCE_TYPE_RIDE_ENTRANCE) continue; if ((ghost == false) && (tileElement->flags & TILE_ELEMENT_FLAG_GHOST)) @@ -4022,7 +4022,7 @@ rct_tile_element* map_get_ride_exit_element_at(int32_t x, int32_t y, int32_t z, if (tileElement->base_height != z) continue; - if (tileElement->properties.entrance.type != ENTRANCE_TYPE_RIDE_EXIT) + if (tileElement->AsEntrance()->GetEntranceType() != ENTRANCE_TYPE_RIDE_EXIT) continue; if ((ghost == false) && (tileElement->flags & TILE_ELEMENT_FLAG_GHOST)) @@ -4821,7 +4821,7 @@ uint16_t check_max_allowable_land_rights_for_tile(uint8_t x, uint8_t y, uint8_t { int32_t type = tileElement->GetType(); if (type == TILE_ELEMENT_TYPE_PATH - || (type == TILE_ELEMENT_TYPE_ENTRANCE && tileElement->properties.entrance.type == ENTRANCE_TYPE_PARK_ENTRANCE)) + || (type == TILE_ELEMENT_TYPE_ENTRANCE && tileElement->AsEntrance()->GetEntranceType() == ENTRANCE_TYPE_PARK_ENTRANCE)) { destOwnership = OWNERSHIP_CONSTRUCTION_RIGHTS_OWNED; // Do not own construction rights if too high/below surface @@ -4851,8 +4851,3 @@ void FixLandOwnershipTilesWithOwnership(std::initializer_list tile update_park_fences_around_tile({ (*tile).x * 32, (*tile).y * 32 }); } } - -uint8_t entrance_element_get_type(const rct_tile_element* tileElement) -{ - return (tileElement->properties.entrance.type); -} diff --git a/src/openrct2/world/Map.h b/src/openrct2/world/Map.h index 15d80f0cda..0f01733bd3 100644 --- a/src/openrct2/world/Map.h +++ b/src/openrct2/world/Map.h @@ -297,6 +297,4 @@ void FixLandOwnershipTilesWithOwnership(std::initializer_list tile bool place_peep_spawn(CoordsXYZD location); -uint8_t entrance_element_get_type(const rct_tile_element* tileElement); - #endif diff --git a/src/openrct2/world/MapAnimation.cpp b/src/openrct2/world/MapAnimation.cpp index 9a447ae583..ac751b6724 100644 --- a/src/openrct2/world/MapAnimation.cpp +++ b/src/openrct2/world/MapAnimation.cpp @@ -114,7 +114,7 @@ static bool map_animation_invalidate_ride_entrance(int32_t x, int32_t y, int32_t continue; if (tileElement->GetType() != TILE_ELEMENT_TYPE_ENTRANCE) continue; - if (tileElement->properties.entrance.type != ENTRANCE_TYPE_RIDE_ENTRANCE) + if (tileElement->AsEntrance()->GetEntranceType() != ENTRANCE_TYPE_RIDE_ENTRANCE) continue; ride = get_ride(tileElement->properties.entrance.ride_index); @@ -246,7 +246,7 @@ static bool map_animation_invalidate_park_entrance(int32_t x, int32_t y, int32_t continue; if (tileElement->GetType() != TILE_ELEMENT_TYPE_ENTRANCE) continue; - if (tileElement->properties.entrance.type != ENTRANCE_TYPE_PARK_ENTRANCE) + if (tileElement->AsEntrance()->GetEntranceType() != ENTRANCE_TYPE_PARK_ENTRANCE) continue; if (tileElement->properties.entrance.index & 0x0F) continue; diff --git a/src/openrct2/world/Park.cpp b/src/openrct2/world/Park.cpp index 531b1f15dc..ef6b54603f 100644 --- a/src/openrct2/world/Park.cpp +++ b/src/openrct2/world/Park.cpp @@ -185,7 +185,7 @@ void update_park_fences(const CoordsXY coords) if (tileElement->GetType() != TILE_ELEMENT_TYPE_ENTRANCE) continue; - if (tileElement->properties.entrance.type != ENTRANCE_TYPE_PARK_ENTRANCE) + if (tileElement->AsEntrance()->GetEntranceType() != ENTRANCE_TYPE_PARK_ENTRANCE) continue; if (!(tileElement->flags & TILE_ELEMENT_FLAG_GHOST)) diff --git a/src/openrct2/world/TileElement.h b/src/openrct2/world/TileElement.h index a02462b8ff..08dbaa8b8e 100644 --- a/src/openrct2/world/TileElement.h +++ b/src/openrct2/world/TileElement.h @@ -381,6 +381,9 @@ private: uint8_t rideIndex; // 7 public: + uint8_t GetEntranceType() const; + void SetEntranceType(uint8_t newType); + uint8_t GetStationIndex() const; void SetStationIndex(uint8_t stationIndex); }; diff --git a/src/openrct2/world/TileInspector.cpp b/src/openrct2/world/TileInspector.cpp index 1b1a18cac3..580ca589d4 100644 --- a/src/openrct2/world/TileInspector.cpp +++ b/src/openrct2/world/TileInspector.cpp @@ -245,7 +245,7 @@ int32_t tile_inspector_rotate_element_at(int32_t x, int32_t y, int32_t elementIn uint8_t stationIndex = tileElement->properties.entrance.index; auto entrance = ride_get_entrance_location(ride, stationIndex); auto exit = ride_get_exit_location(ride, stationIndex); - uint8_t entranceType = entrance_element_get_type(tileElement); + uint8_t entranceType = tileElement->AsEntrance()->GetEntranceType(); uint8_t z = tileElement->base_height; // Make sure this is the correct entrance or exit @@ -437,7 +437,7 @@ int32_t tile_inspector_any_base_height_offset(int32_t x, int32_t y, int16_t elem { if (tileElement->GetType() == TILE_ELEMENT_TYPE_ENTRANCE) { - uint8_t entranceType = tileElement->properties.entrance.type; + uint8_t entranceType = tileElement->AsEntrance()->GetEntranceType(); if (entranceType != ENTRANCE_TYPE_PARK_ENTRANCE) { // Update the ride's known entrance or exit height @@ -673,7 +673,7 @@ int32_t tile_inspector_entrance_make_usable(int32_t x, int32_t y, int32_t elemen { uint8_t stationIndex = entranceElement->properties.entrance.index >> 6; - switch (entranceElement->properties.entrance.type) + switch (entranceElement->AsEntrance()->GetEntranceType()) { case ENTRANCE_TYPE_RIDE_ENTRANCE: ride_set_entrance_location(