Merge pull request #8023 from Gymnasiast/enteruuuuh

Port entrance and banner index to new structure
This commit is contained in:
Michael Steenbeek authored and GitHub committed 2018-09-29 13:24:01 +02:00
commit 2ccc183f18
29 files changed
+342 -242

No files matched your search

@@ -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)
{
@@ -330,7 +330,7 @@ int32_t viewport_interaction_get_item_right(int32_t x, int32_t y, viewport_inter
break;
case VIEWPORT_INTERACTION_ITEM_BANNER:
banner = &gBanners[tileElement->properties.banner.index];
banner = &gBanners[tileElement->AsBanner()->GetIndex()];
sceneryEntry = get_banner_entry(banner->type);
set_map_tooltip_format_arg(0, rct_string_id, STR_MAP_TOOLTIP_STRINGID_CLICK_TO_MODIFY);
@@ -452,7 +452,7 @@ int32_t viewport_interaction_right_click(int32_t x, int32_t y)
viewport_interaction_remove_large_scenery(info.tileElement, info.x, info.y);
break;
case VIEWPORT_INTERACTION_ITEM_BANNER:
context_open_detail_window(WD_BANNER, info.tileElement->properties.banner.index);
context_open_detail_window(WD_BANNER, info.tileElement->AsBanner()->GetIndex());
break;
}
@@ -523,7 +523,7 @@ static void viewport_interaction_remove_footpath_item(rct_tile_element* tileElem
void viewport_interaction_remove_park_entrance(rct_tile_element* tileElement, int32_t x, int32_t y)
{
int32_t rotation = tileElement->GetDirectionWithOffset(1);
switch (tileElement->properties.entrance.index & 0x0F)
switch (tileElement->AsEntrance()->GetSequenceIndex())
{
case 1:
x += CoordsDirectionDelta[rotation].x;
+4 -4
View File
@@ -135,7 +135,7 @@ rct_window* window_banner_open(rct_windownumber number)
rct_tile_element* tile_element = map_get_first_element_at(view_x / 32, view_y / 32);
while (1)
{
if ((tile_element->GetType() == TILE_ELEMENT_TYPE_BANNER) && (tile_element->properties.banner.index == w->number))
if ((tile_element->GetType() == TILE_ELEMENT_TYPE_BANNER) && (tile_element->AsBanner()->GetIndex() == w->number))
{
break;
}
@@ -175,7 +175,7 @@ static void window_banner_mouseup(rct_window* w, rct_widgetindex widgetIndex)
while (1)
{
if ((tile_element->GetType() == TILE_ELEMENT_TYPE_BANNER) && (tile_element->properties.banner.index == w->number))
if ((tile_element->GetType() == TILE_ELEMENT_TYPE_BANNER) && (tile_element->AsBanner()->GetIndex() == w->number))
break;
tile_element++;
}
@@ -187,8 +187,8 @@ static void window_banner_mouseup(rct_window* w, rct_widgetindex widgetIndex)
break;
case WIDX_BANNER_DEMOLISH:
game_do_command(
x, 1, y, tile_element->base_height | (tile_element->properties.banner.position << 8),
GAME_COMMAND_REMOVE_BANNER, 0, 0);
x, 1, y, tile_element->base_height | (tile_element->AsBanner()->GetPosition() << 8), GAME_COMMAND_REMOVE_BANNER,
0, 0);
break;
case WIDX_BANNER_TEXT:
window_text_input_open(
+1 -1
View File
@@ -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:
+1 -1
View File
@@ -1640,7 +1640,7 @@ rct_window* window_ride_open_track(rct_tile_element* tileElement)
if (tileElement->GetType() == TILE_ELEMENT_TYPE_ENTRANCE)
{
int32_t rideIndex = tileElement->properties.entrance.ride_index;
int32_t rideIndex = tileElement->AsEntrance()->GetRideIndex();
// Open ride window in station view
return window_ride_open_station(rideIndex, tileElement->AsEntrance()->GetStationIndex());
}
+15 -15
View File
@@ -1608,7 +1608,8 @@ 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:
{
@@ -1658,16 +1659,16 @@ static void window_tile_inspector_invalidate(rct_window* w)
w->widgets[WIDX_BANNER_CHECK_BLOCK_NW].bottom = GBBB(propertiesAnchor, 1);
widget_set_checkbox_value(
w, WIDX_BANNER_CHECK_BLOCK_NE,
!(tileElement->properties.banner.flags & (1 << ((0 - get_current_rotation()) & 3))));
!(tileElement->AsBanner()->GetAllowedEdges() & (1 << ((0 - get_current_rotation()) & 3))));
widget_set_checkbox_value(
w, WIDX_BANNER_CHECK_BLOCK_SE,
!(tileElement->properties.banner.flags & (1 << ((1 - get_current_rotation()) & 3))));
!(tileElement->AsBanner()->GetAllowedEdges() & (1 << ((1 - get_current_rotation()) & 3))));
widget_set_checkbox_value(
w, WIDX_BANNER_CHECK_BLOCK_SW,
!(tileElement->properties.banner.flags & (1 << ((2 - get_current_rotation()) & 3))));
!(tileElement->AsBanner()->GetAllowedEdges() & (1 << ((2 - get_current_rotation()) & 3))));
widget_set_checkbox_value(
w, WIDX_BANNER_CHECK_BLOCK_NW,
!(tileElement->properties.banner.flags & (1 << ((3 - get_current_rotation()) & 3))));
!(tileElement->AsBanner()->GetAllowedEdges() & (1 << ((3 - get_current_rotation()) & 3))));
break;
case TILE_INSPECTOR_PAGE_CORRUPT:
w->widgets[WIDX_CORRUPT_SPINNER_HEIGHT].top = GBBT(propertiesAnchor, 0) + 3;
@@ -1918,10 +1919,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;
@@ -1933,9 +1934,8 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi)
}
else
{
int16_t rideEntranceIndex = (tileElement->properties.entrance.index & 0x30)
>> 4; // TODO: use mask or function
if (tileElement->properties.entrance.type == ENTRANCE_TYPE_RIDE_ENTRANCE)
int16_t rideEntranceIndex = tileElement->AsEntrance()->GetStationIndex();
if (tileElement->AsEntrance()->GetEntranceType() == ENTRANCE_TYPE_RIDE_ENTRANCE)
{
// Ride entrance ID
gfx_draw_string_left(
@@ -1949,16 +1949,16 @@ 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];
rct_string_id entrancePart = ParkEntrancePartStringIds[tileElement->AsEntrance()->GetSequenceIndex()];
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_ENTRANCE_PART, &entrancePart, COLOUR_DARK_GREEN, x, y + 22);
}
else
{
// Ride ID
int16_t rideId = tileElement->properties.entrance.ride_index;
int16_t rideId = tileElement->AsEntrance()->GetRideIndex();
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_ENTRANCE_RIDE_ID, &rideId, COLOUR_DARK_GREEN, x, y + 22);
}
@@ -2052,7 +2052,7 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi)
{
// Details
// Banner info
const uint8_t bannerIndex = tileElement->properties.banner.index;
const uint8_t bannerIndex = tileElement->AsBanner()->GetIndex();
if (gBanners[bannerIndex].flags & BANNER_FLAG_NO_ENTRY)
{
rct_string_id noEntryStringIdx = STR_NO_ENTRY;
@@ -2167,7 +2167,7 @@ static void window_tile_inspector_scrollpaint(rct_window* w, rct_drawpixelinfo*
case TILE_ELEMENT_TYPE_BANNER:
snprintf(
buffer, sizeof(buffer), "%s (%d)", language_get_string(STR_BANNER_WINDOW_TITLE),
tileElement->properties.banner.index);
tileElement->AsBanner()->GetIndex());
typeName = buffer;
break;
case TILE_ELEMENT_TYPE_CORRUPT:
+3 -3
View File
@@ -1031,13 +1031,13 @@ static void repaint_scenery_tool_down(int16_t x, int16_t y, rct_widgetindex widg
}
case VIEWPORT_INTERACTION_ITEM_BANNER:
{
rct_banner* banner = &gBanners[tile_element->properties.banner.index];
rct_banner* banner = &gBanners[tile_element->AsBanner()->GetIndex()];
rct_scenery_entry* scenery_entry = get_banner_entry(banner->type);
if (scenery_entry->banner.flags & BANNER_ENTRY_FLAG_HAS_PRIMARY_COLOUR)
{
gGameCommandErrorTitle = STR_CANT_REPAINT_THIS;
game_do_command(
grid_x, 1, grid_y, tile_element->base_height | ((tile_element->properties.banner.position & 0x3) << 8),
grid_x, 1, grid_y, tile_element->base_height | ((tile_element->AsBanner()->GetPosition() & 0x3) << 8),
GAME_COMMAND_SET_BANNER_COLOUR, 0, gWindowSceneryPrimaryColour | (gWindowScenerySecondaryColour << 8));
}
break;
@@ -1114,7 +1114,7 @@ static void scenery_eyedropper_tool_down(int16_t x, int16_t y, rct_widgetindex w
}
case VIEWPORT_INTERACTION_ITEM_BANNER:
{
int32_t bannerIndex = tileElement->properties.banner.index;
int32_t bannerIndex = tileElement->AsBanner()->GetIndex();
rct_banner* banner = &gBanners[bannerIndex];
rct_scenery_entry* sceneryEntry = get_banner_entry(banner->type);
if (sceneryEntry != nullptr)
@@ -148,15 +148,15 @@ 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)
if (iter.element->AsEntrance()->GetSequenceIndex() != 0)
break;
Editor::SetSelectedObject(OBJECT_TYPE_PARK_ENTRANCE, 0, OBJECT_SELECTION_FLAG_SELECTED);
type = iter.element->properties.entrance.path_type;
type = iter.element->AsEntrance()->GetPathType();
assert(type < object_entry_group_counts[OBJECT_TYPE_PATHS]);
Editor::SetSelectedObject(OBJECT_TYPE_PATHS, type, OBJECT_SELECTION_FLAG_SELECTED);
break;
@@ -171,7 +171,7 @@ void setup_in_use_selection_flags()
Editor::SetSelectedObject(OBJECT_TYPE_LARGE_SCENERY, type, OBJECT_SELECTION_FLAG_SELECTED);
break;
case TILE_ELEMENT_TYPE_BANNER:
banner = &gBanners[iter.element->properties.banner.index];
banner = &gBanners[iter.element->AsBanner()->GetIndex()];
type = banner->type;
assert(type < object_entry_group_counts[OBJECT_TYPE_BANNERS]);
Editor::SetSelectedObject(OBJECT_TYPE_BANNERS, type, OBJECT_SELECTION_FLAG_SELECTED);
@@ -121,7 +121,7 @@ public:
}
// Check that entrance element does not already exist at this location
rct_tile_element* entranceElement = map_get_park_entrance_element_at(entranceLoc.x, entranceLoc.y, zLow, false);
EntranceElement* entranceElement = map_get_park_entrance_element_at(entranceLoc.x, entranceLoc.y, zLow, false);
if (entranceElement != nullptr)
{
return std::make_unique<GameActionResult>(
@@ -183,18 +183,24 @@ public:
rct_tile_element* newElement = tile_element_insert(entranceLoc.x / 32, entranceLoc.y / 32, zLow, 0xF);
Guard::Assert(newElement != nullptr);
newElement->clearance_height = zHigh;
newElement->SetType(TILE_ELEMENT_TYPE_ENTRANCE);
auto entranceElement = newElement->AsEntrance();
if (entranceElement == nullptr)
{
Guard::Assert(false);
return nullptr;
}
entranceElement->clearance_height = zHigh;
if (flags & GAME_COMMAND_FLAG_GHOST)
{
newElement->flags |= TILE_ELEMENT_FLAG_GHOST;
}
newElement->SetType(TILE_ELEMENT_TYPE_ENTRANCE);
newElement->SetDirection(_direction);
newElement->properties.entrance.index = index;
newElement->properties.entrance.type = ENTRANCE_TYPE_PARK_ENTRANCE;
newElement->properties.entrance.path_type = gFootpathSelectedId;
entranceElement->SetDirection(_direction);
entranceElement->SetSequenceIndex(index);
entranceElement->SetEntranceType(ENTRANCE_TYPE_PARK_ENTRANCE);
entranceElement->SetPathType(gFootpathSelectedId);
if (!(flags & GAME_COMMAND_FLAG_GHOST))
{
+2 -2
View File
@@ -288,11 +288,11 @@ 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;
if (it.element->properties.entrance.ride_index == _rideIndex)
if (it.element->AsEntrance()->GetRideIndex() == _rideIndex)
{
tile_element_remove(it.element);
tile_element_iterator_restart_for_tile(&it);
@@ -43,14 +43,14 @@ void banner_paint(paint_session* session, uint8_t direction, int32_t height, con
height -= 16;
rct_scenery_entry* banner_scenery = get_banner_entry(gBanners[tile_element->properties.banner.index].type);
rct_scenery_entry* banner_scenery = get_banner_entry(gBanners[tile_element->AsBanner()->GetIndex()].type);
if (banner_scenery == nullptr)
{
return;
}
direction += tile_element->properties.banner.position;
direction += tile_element->AsBanner()->GetPosition();
direction &= 3;
boundBoxOffsetX = BannerBoundBoxes[direction][0].x;
@@ -67,7 +67,7 @@ void banner_paint(paint_session* session, uint8_t direction, int32_t height, con
}
else
{
image_id |= (gBanners[tile_element->properties.banner.index].colour << 19) | IMAGE_TYPE_REMAP;
image_id |= (gBanners[tile_element->AsBanner()->GetIndex()].colour << 19) | IMAGE_TYPE_REMAP;
}
sub_98197C(session, image_id, 0, 0, 1, 1, 0x15, height, boundBoxOffsetX, boundBoxOffsetY, boundBoxOffsetZ);
@@ -96,9 +96,9 @@ void banner_paint(paint_session* session, uint8_t direction, int32_t height, con
set_format_arg(4, uint32_t, 0);
rct_string_id string_id = STR_NO_ENTRY;
if (!(gBanners[tile_element->properties.banner.index].flags & BANNER_FLAG_NO_ENTRY))
if (!(gBanners[tile_element->AsBanner()->GetIndex()].flags & BANNER_FLAG_NO_ENTRY))
{
set_format_arg(0, rct_string_id, gBanners[tile_element->properties.banner.index].string_idx);
set_format_arg(0, rct_string_id, gBanners[tile_element->AsBanner()->GetIndex()].string_idx);
string_id = STR_BANNER_TEXT_FORMAT;
}
if (gConfigGeneral.upper_case_banners)
@@ -30,11 +30,11 @@ 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))
{
if (tile_element->properties.entrance.ride_index != gTrackDesignSaveRideIndex)
if (tile_element->AsEntrance()->GetRideIndex() != gTrackDesignSaveRideIndex)
return;
}
@@ -68,7 +68,7 @@ static void ride_entrance_exit_paint(
}
#endif
Ride* ride = get_ride(tile_element->properties.entrance.ride_index);
Ride* ride = get_ride(tile_element->AsEntrance()->GetRideIndex());
if (ride->entrance_style == RIDE_ENTRANCE_STYLE_NONE)
return;
@@ -155,7 +155,7 @@ static void ride_entrance_exit_paint(
paint_util_push_tunnel_left(session, height, TUNNEL_6);
}
if (!is_exit && !(tile_element->flags & TILE_ELEMENT_FLAG_GHOST) && tile_element->properties.entrance.ride_index != 0xFF)
if (!is_exit && !(tile_element->flags & TILE_ELEMENT_FLAG_GHOST) && tile_element->AsEntrance()->GetRideIndex() != 0xFF)
{
set_format_arg(0, uint32_t, 0);
set_format_arg(4, uint32_t, 0);
@@ -231,13 +231,13 @@ static void park_entrance_paint(paint_session* session, uint8_t direction, int32
// Index to which part of the entrance
// Middle, left, right
uint8_t part_index = tile_element->properties.entrance.index & 0xF;
uint8_t part_index = tile_element->AsEntrance()->GetSequenceIndex();
rct_footpath_entry* path_entry = nullptr;
// The left and right of the park entrance often have this set to 127.
// So only attempt to get the footpath type if we're dealing with the middle bit of the entrance.
if (part_index == 0)
path_entry = get_footpath_entry(tile_element->properties.entrance.path_type);
path_entry = get_footpath_entry(tile_element->AsEntrance()->GetPathType());
rct_entrance_type* entrance;
uint8_t di = ((direction / 2 + part_index / 2) & 1) ? 0x1A : 0x20;
@@ -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:
+1 -1
View File
@@ -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;
+6 -6
View File
@@ -86,7 +86,7 @@ static int32_t banner_clear_path_edges(rct_tile_element* tileElement, int32_t ed
{
do
{
edges &= bannerElement->properties.banner.flags;
edges &= bannerElement->AsBanner()->GetAllowedEdges();
} while ((bannerElement = get_banner_on_path(bannerElement)) != nullptr);
}
return edges;
@@ -313,13 +313,13 @@ 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();
if (direction == chosenDirection)
{
*outRideIndex = tileElement->properties.entrance.ride_index;
*outRideIndex = tileElement->AsEntrance()->GetRideIndex();
return PATH_SEARCH_RIDE_ENTRANCE;
}
break;
@@ -327,7 +327,7 @@ static uint8_t footpath_element_dest_in_dir(
direction = tileElement->GetDirection();
if (direction == chosenDirection)
{
*outRideIndex = tileElement->properties.entrance.ride_index;
*outRideIndex = tileElement->AsEntrance()->GetRideIndex();
return PATH_SEARCH_RIDE_EXIT;
}
break;
@@ -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
@@ -686,7 +686,7 @@ static void peep_pathfind_heuristic_search(
{
/* The rideIndex will be useful for
* adding transport rides later. */
rideIndex = tileElement->properties.entrance.ride_index;
rideIndex = tileElement->AsEntrance()->GetRideIndex();
searchResult = PATH_SEARCH_RIDE_ENTRANCE;
found = true;
break;
+4 -4
View File
@@ -2429,8 +2429,8 @@ 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 rideIndex = tile_element->properties.entrance.ride_index;
uint8_t entranceType = tile_element->AsEntrance()->GetEntranceType();
uint8_t rideIndex = tile_element->AsEntrance()->GetRideIndex();
// Store some details to determine when to override the default
// behaviour (defined below) for when staff attempt to enter a ride
@@ -2486,7 +2486,7 @@ static void peep_interact_with_entrance(
}
peep->time_lost = 0;
uint8_t stationNum = (tile_element->properties.entrance.index >> 4) & 0x7;
uint8_t stationNum = tile_element->AsEntrance()->GetStationIndex();
// Guest walks up to the ride for the first time since entering
// the path tile or since considering another ride attached to
// the path tile.
@@ -2538,7 +2538,7 @@ static void peep_interact_with_entrance(
}
// If not the centre of the entrance arch
if (tile_element->properties.entrance.index & 0xF)
if (tile_element->AsEntrance()->GetSequenceIndex() != 0)
{
peep_return_to_centre_of_tile(peep);
return;
+4 -4
View File
@@ -1935,10 +1935,10 @@ void rct_peep::UpdateHeadingToInspect()
return;
}
if (current_ride != rideEntranceExitElement->properties.entrance.ride_index)
if (current_ride != rideEntranceExitElement->AsEntrance()->GetRideIndex())
return;
uint8_t exit_index = ((rideEntranceExitElement->properties.entrance.index & 0x70) >> 4);
uint8_t exit_index = rideEntranceExitElement->AsEntrance()->GetStationIndex();
if (current_ride_station != exit_index)
return;
@@ -2053,10 +2053,10 @@ void rct_peep::UpdateAnswering()
return;
}
if (current_ride != rideEntranceExitElement->properties.entrance.ride_index)
if (current_ride != rideEntranceExitElement->AsEntrance()->GetRideIndex())
return;
uint8_t exit_index = ((rideEntranceExitElement->properties.entrance.index & 0x70) >> 4);
uint8_t exit_index = rideEntranceExitElement->AsEntrance()->GetStationIndex();
if (current_ride_station != exit_index)
return;
+6 -6
View File
@@ -2536,15 +2536,15 @@ 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;
uint8_t pathType = tileElement->AsEntrance()->GetPathType();
if (pathType == 0)
{
pathType = RCT1_FOOTPATH_TYPE_TARMAC_GRAY;
}
uint8_t entryIndex = _pathTypeToEntryMap[pathType];
tileElement->properties.entrance.path_type = entryIndex & 0x7F;
tileElement->AsEntrance()->SetPathType(entryIndex & 0x7F);
}
break;
}
@@ -2646,7 +2646,7 @@ private:
{
if (tileElement->GetType() == TILE_ELEMENT_TYPE_BANNER)
{
uint8_t index = tileElement->properties.banner.index;
uint8_t index = tileElement->AsBanner()->GetIndex();
rct_banner* src = &_s4.banners[index];
rct_banner* dst = &gBanners[index];
ImportBanner(dst, src);
@@ -2708,9 +2708,9 @@ 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)
if ((element->AsEntrance()->GetSequenceIndex()) != 0)
continue;
gParkEntrances[entranceIndex].x = it.x * 32;
+36 -35
View File
@@ -1874,13 +1874,13 @@ static int32_t ride_modify_entrance_or_exit(rct_tile_element* tileElement, int32
int32_t rideIndex, entranceType;
rct_window* constructionWindow;
rideIndex = tileElement->properties.entrance.ride_index;
rideIndex = tileElement->AsEntrance()->GetRideIndex();
entranceType = tileElement->properties.entrance.type;
entranceType = tileElement->AsEntrance()->GetEntranceType();
if (entranceType != ENTRANCE_TYPE_RIDE_ENTRANCE && entranceType != ENTRANCE_TYPE_RIDE_EXIT)
return 0;
int32_t bl = (tileElement->properties.entrance.index & 0x70) >> 4;
int32_t stationIndex = tileElement->AsEntrance()->GetStationIndex();
// Get or create construction window for ride
constructionWindow = window_find_by_class(WC_RIDE_CONSTRUCTION);
@@ -1905,7 +1905,7 @@ static int32_t ride_modify_entrance_or_exit(rct_tile_element* tileElement, int32
TOOL_CROSSHAIR);
gRideEntranceExitPlaceType = entranceType;
gRideEntranceExitPlaceRideIndex = rideIndex;
gRideEntranceExitPlaceStationIndex = bl;
gRideEntranceExitPlaceStationIndex = stationIndex;
input_set_flag(INPUT_FLAG_6, true);
if (_rideConstructionState != RIDE_CONSTRUCTION_STATE_ENTRANCE_EXIT)
{
@@ -1921,7 +1921,7 @@ static int32_t ride_modify_entrance_or_exit(rct_tile_element* tileElement, int32
// Remove entrance / exit
game_do_command(
x, (GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_APPLY), y, rideIndex,
GAME_COMMAND_REMOVE_RIDE_ENTRANCE_OR_EXIT, bl, 0);
GAME_COMMAND_REMOVE_RIDE_ENTRANCE_OR_EXIT, stationIndex, 0);
gCurrentToolWidget.widget_index = entranceType == ENTRANCE_TYPE_RIDE_ENTRANCE ? WC_RIDE_CONSTRUCTION__WIDX_ENTRANCE
: WC_RIDE_CONSTRUCTION__WIDX_EXIT;
gRideEntranceExitPlaceType = entranceType;
@@ -3603,7 +3603,7 @@ static void ride_entrance_set_map_tooltip(rct_tile_element* tileElement)
int32_t i, rideIndex, stationIndex;
Ride* ride;
rideIndex = tileElement->properties.entrance.ride_index;
rideIndex = tileElement->AsEntrance()->GetRideIndex();
ride = get_ride(rideIndex);
// Get the station
@@ -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;
}
@@ -8145,9 +8145,9 @@ void sub_6CB945(int32_t rideIndex)
{
if (tileElement->GetType() != TILE_ELEMENT_TYPE_ENTRANCE)
continue;
if (tileElement->properties.entrance.ride_index != rideIndex)
if (tileElement->AsEntrance()->GetRideIndex() != 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;
@@ -8205,8 +8205,7 @@ void sub_6CB945(int32_t rideIndex)
ride_set_entrance_location(ride, stationId, entranceLocation);
}
tileElement->properties.entrance.index &= 0x8F;
tileElement->properties.entrance.index |= stationId << 4;
tileElement->AsEntrance()->SetStationIndex(stationId);
shouldRemove = false;
} while (!(trackElement++)->IsLastForTile());
@@ -8795,36 +8794,37 @@ void determine_ride_entrance_and_exit_locations()
TileCoordsXYZD exitLoc = ride->exits[stationIndex];
bool fixEntrance = false;
bool fixExit = false;
const rct_tile_element* tileElement;
// Skip if the station has no entrance
if (!entranceLoc.isNull())
{
tileElement = map_get_ride_entrance_element_at(entranceLoc.x * 32, entranceLoc.y * 32, entranceLoc.z, false);
const EntranceElement* entranceElement = map_get_ride_entrance_element_at(
entranceLoc.x * 32, entranceLoc.y * 32, entranceLoc.z, false);
if (tileElement == nullptr || tileElement->properties.entrance.ride_index != rideIndex
|| tileElement->AsEntrance()->GetStationIndex() != stationIndex)
if (entranceElement == nullptr || entranceElement->GetRideIndex() != rideIndex
|| entranceElement->GetStationIndex() != stationIndex)
{
fixEntrance = true;
}
else
{
ride->entrances[stationIndex].direction = (uint8_t)tileElement->GetDirection();
ride->entrances[stationIndex].direction = (uint8_t)entranceElement->GetDirection();
}
}
if (!exitLoc.isNull())
{
tileElement = map_get_ride_exit_element_at(exitLoc.x * 32, exitLoc.y * 32, entranceLoc.z, false);
const EntranceElement* entranceElement = map_get_ride_exit_element_at(
exitLoc.x * 32, exitLoc.y * 32, entranceLoc.z, false);
if (tileElement == nullptr || tileElement->properties.entrance.ride_index != rideIndex
|| tileElement->AsEntrance()->GetStationIndex() != stationIndex)
if (entranceElement == nullptr || entranceElement->GetRideIndex() != rideIndex
|| entranceElement->GetStationIndex() != stationIndex)
{
fixExit = true;
}
else
{
ride->exits[stationIndex].direction = (uint8_t)tileElement->GetDirection();
ride->exits[stationIndex].direction = (uint8_t)entranceElement->GetDirection();
}
}
@@ -8841,7 +8841,7 @@ void determine_ride_entrance_and_exit_locations()
{
for (uint8_t y = 1; y < MAXIMUM_MAP_SIZE_TECHNICAL - 1; y++)
{
tileElement = map_get_first_element_at(x, y);
rct_tile_element* tileElement = map_get_first_element_at(x, y);
if (tileElement != nullptr)
{
@@ -8851,11 +8851,12 @@ void determine_ride_entrance_and_exit_locations()
{
continue;
}
if (tileElement->properties.entrance.ride_index != rideIndex)
const EntranceElement* entranceElement = tileElement->AsEntrance();
if (entranceElement->GetRideIndex() != rideIndex)
{
continue;
}
if (tileElement->AsEntrance()->GetStationIndex() != stationIndex)
if (entranceElement->GetStationIndex() != stationIndex)
{
continue;
}
@@ -8863,13 +8864,13 @@ 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 && entranceElement->GetEntranceType() == ENTRANCE_TYPE_RIDE_ENTRANCE)
{
if (alreadyFoundEntrance)
{
if (ride->entrances[stationIndex].z == expectedHeight)
continue;
if (ride->entrances[stationIndex].z > tileElement->base_height)
if (ride->entrances[stationIndex].z > entranceElement->base_height)
continue;
}
@@ -8877,35 +8878,35 @@ void determine_ride_entrance_and_exit_locations()
TileCoordsXYZD newEntranceLoc = {
x,
y,
tileElement->base_height,
(uint8_t)tileElement->GetDirection(),
entranceElement->base_height,
(uint8_t)entranceElement->GetDirection(),
};
ride_set_entrance_location(ride, stationIndex, newEntranceLoc);
alreadyFoundEntrance = true;
log_verbose(
"Fixed disconnected entrance of ride %d, station %d to x = %d, y = %d and z = %d.",
rideIndex, stationIndex, x, y, tileElement->base_height);
rideIndex, stationIndex, x, y, entranceElement->base_height);
}
else if (fixExit && tileElement->properties.entrance.type == ENTRANCE_TYPE_RIDE_EXIT)
else if (fixExit && entranceElement->GetEntranceType() == ENTRANCE_TYPE_RIDE_EXIT)
{
if (alreadyFoundExit)
{
if (ride->exits[stationIndex].z == expectedHeight)
continue;
if (ride->exits[stationIndex].z > tileElement->base_height)
if (ride->exits[stationIndex].z > entranceElement->base_height)
continue;
}
// Found our exit
ride_set_exit_location(
ride, stationIndex,
{ x, y, tileElement->base_height, (uint8_t)tileElement->GetDirection() });
{ x, y, entranceElement->base_height, (uint8_t)entranceElement->GetDirection() });
alreadyFoundExit = true;
log_verbose(
"Fixed disconnected exit of ride %d, station %d to x = %d, y = %d and z = %d.", rideIndex,
stationIndex, x, y, tileElement->base_height);
stationIndex, x, y, entranceElement->base_height);
}
} while (!(tileElement++)->IsLastForTile());
}
+8 -7
View File
@@ -605,11 +605,12 @@ 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)
if (tileElement->AsEntrance()->GetRideIndex() == rideIndex)
return true;
break;
}
@@ -926,9 +927,9 @@ 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)
if (tileElement->AsEntrance()->GetRideIndex() == rideIndex)
break;
} while (!(tileElement++)->IsLastForTile());
// Add something that stops this from walking off the end
@@ -956,9 +957,9 @@ 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)
if (tileElement->AsEntrance()->GetRideIndex() == rideIndex)
break;
} while (!(tileElement++)->IsLastForTile());
// Add something that stops this from walking off the end
+53 -17
View File
@@ -80,13 +80,13 @@ static money32 BannerRemove(int16_t x, int16_t y, uint8_t baseHeight, uint8_t di
// Slight modification to the code so that it now checks height as well
// This was causing a bug with banners on two paths stacked.
rct_tile_element* tileElement = map_get_banner_element_at(x / 32, y / 32, baseHeight, direction);
BannerElement* tileElement = map_get_banner_element_at(x / 32, y / 32, baseHeight, direction);
if (tileElement == nullptr)
{
return MONEY32_UNDEFINED;
}
rct_banner* banner = &gBanners[tileElement->properties.banner.index];
rct_banner* banner = &gBanners[tileElement->GetIndex()];
rct_scenery_entry* bannerEntry = get_banner_entry(banner->type);
money32 refund = 0;
if (bannerEntry != nullptr)
@@ -105,9 +105,9 @@ static money32 BannerRemove(int16_t x, int16_t y, uint8_t baseHeight, uint8_t di
network_set_player_last_action_coord(network_get_player_index(game_command_playerid), coord);
}
tile_element_remove_banner_entry(tileElement);
tile_element_remove_banner_entry((rct_tile_element*)tileElement);
map_invalidate_tile_zoom1(x, y, z, z + 32);
tile_element_remove(tileElement);
tileElement->Remove();
}
if (gParkFlags & PARK_FLAGS_NO_MONEY)
@@ -140,7 +140,7 @@ static money32 BannerSetColour(int16_t x, int16_t y, uint8_t baseHeight, uint8_t
if (tileElement->GetType() != TILE_ELEMENT_TYPE_BANNER)
continue;
if (tileElement->properties.banner.position != direction)
if (tileElement->AsBanner()->GetPosition() != direction)
continue;
found = true;
@@ -153,10 +153,10 @@ static money32 BannerSetColour(int16_t x, int16_t y, uint8_t baseHeight, uint8_t
}
auto intent = Intent(INTENT_ACTION_UPDATE_BANNER);
intent.putExtra(INTENT_EXTRA_BANNER_INDEX, tileElement->properties.banner.index);
intent.putExtra(INTENT_EXTRA_BANNER_INDEX, tileElement->AsBanner()->GetIndex());
context_broadcast_intent(&intent);
gBanners[tileElement->properties.banner.index].colour = colour;
gBanners[tileElement->AsBanner()->GetIndex()].colour = colour;
map_invalidate_tile_zoom1(x, y, z, z + 32);
}
@@ -217,8 +217,8 @@ static money32 BannerPlace(
}
uint8_t baseHeight = (pathBaseHeight + 1) * 2;
tileElement = map_get_banner_element_at(x / 32, y / 32, baseHeight, direction);
if (tileElement != nullptr)
BannerElement* bannerElement = map_get_banner_element_at(x / 32, y / 32, baseHeight, direction);
if (bannerElement != nullptr)
{
gGameCommandErrorText = STR_BANNER_SIGN_IN_THE_WAY;
return MONEY32_UNDEFINED;
@@ -249,10 +249,9 @@ static money32 BannerPlace(
gBanners[*bannerIndex].y = y / 32;
newTileElement->SetType(TILE_ELEMENT_TYPE_BANNER);
newTileElement->clearance_height = newTileElement->base_height + 2;
newTileElement->properties.banner.position = direction;
newTileElement->properties.banner.flags = 0xFF;
newTileElement->properties.banner.unused = 0;
newTileElement->properties.banner.index = *bannerIndex;
newTileElement->AsBanner()->SetPosition(direction);
newTileElement->AsBanner()->ResetAllowedEdges();
newTileElement->AsBanner()->SetIndex(*bannerIndex);
if (flags & GAME_COMMAND_FLAG_GHOST)
{
newTileElement->flags |= TILE_ELEMENT_FLAG_GHOST;
@@ -300,11 +299,12 @@ static money32 BannerSetStyle(BannerIndex bannerIndex, uint8_t colour, uint8_t t
banner->text_colour = textColour;
banner->flags = bannerFlags;
tileElement->properties.banner.flags = 0xFF;
uint8_t allowedEdges = 0xF;
if (banner->flags & BANNER_FLAG_NO_ENTRY)
{
tileElement->properties.banner.flags &= ~(1 << tileElement->properties.banner.position);
allowedEdges &= ~(1 << tileElement->AsBanner()->GetPosition());
}
tileElement->AsBanner()->SetAllowedEdges(allowedEdges);
int32_t colourCodepoint = FORMAT_COLOUR_CODE_START + banner->text_colour;
@@ -481,7 +481,7 @@ void fix_duplicated_banners()
// multiple tiles that should both refer to the same banner index.
if (tileElement->GetType() == TILE_ELEMENT_TYPE_BANNER)
{
uint8_t bannerIndex = tileElement->properties.banner.index;
uint8_t bannerIndex = tileElement->AsBanner()->GetIndex();
if (activeBanners[bannerIndex])
{
log_info(
@@ -518,7 +518,7 @@ void fix_duplicated_banners()
newBanner.string_idx = newStringIdx;
}
tileElement->properties.banner.index = newBannerIndex;
tileElement->AsBanner()->SetIndex(newBannerIndex);
}
// Mark banner index as in-use
@@ -569,3 +569,39 @@ void game_command_set_banner_style(
{
*ebx = BannerSetStyle(*ecx & 0xFF, *edx & 0xFF, *edi & 0xFF, *ebp & 0xFF, *ebx & 0xFF);
}
BannerIndex BannerElement::GetIndex() const
{
return index;
}
void BannerElement::SetIndex(BannerIndex newIndex)
{
index = newIndex;
}
uint8_t BannerElement::GetPosition() const
{
return position;
}
void BannerElement::SetPosition(uint8_t newPosition)
{
position = newPosition;
}
uint8_t BannerElement::GetAllowedEdges() const
{
return flags & 0b00001111;
}
void BannerElement::SetAllowedEdges(uint8_t newEdges)
{
flags &= ~0b00001111;
flags |= (newEdges & 0b00001111);
}
void BannerElement::ResetAllowedEdges()
{
flags |= 0b00001111;
}
+52 -11
View File
@@ -33,7 +33,7 @@ uint8_t gRideEntranceExitGhostStationIndex;
static void ParkEntranceRemoveSegment(int32_t x, int32_t y, int32_t z)
{
rct_tile_element* tileElement;
EntranceElement* tileElement;
tileElement = map_get_park_entrance_element_at(x, y, z, true);
if (tileElement == nullptr)
@@ -42,7 +42,7 @@ static void ParkEntranceRemoveSegment(int32_t x, int32_t y, int32_t z)
}
map_invalidate_tile(x, y, tileElement->base_height * 8, tileElement->clearance_height * 8);
tile_element_remove(tileElement);
tileElement->Remove();
update_park_fences({ x, y });
}
@@ -267,9 +267,9 @@ static money32 RideEntranceExitPlace(
tileElement->SetType(TILE_ELEMENT_TYPE_ENTRANCE);
tileElement->SetDirection(direction);
tileElement->clearance_height = clear_z;
tileElement->properties.entrance.type = isExit;
tileElement->properties.entrance.index = stationNum << 4;
tileElement->properties.entrance.ride_index = rideIndex;
tileElement->AsEntrance()->SetEntranceType(isExit ? ENTRANCE_TYPE_RIDE_EXIT : ENTRANCE_TYPE_RIDE_ENTRANCE);
tileElement->AsEntrance()->SetStationIndex(stationNum);
tileElement->AsEntrance()->SetRideIndex(rideIndex);
if (flags & GAME_COMMAND_FLAG_GHOST)
{
@@ -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);
@@ -548,7 +548,7 @@ void maze_entrance_hedge_replacement(int32_t x, int32_t y, rct_tile_element* til
x += CoordsDirectionDelta[direction].x;
y += CoordsDirectionDelta[direction].y;
int32_t z = tileElement->base_height;
int32_t rideIndex = tileElement->properties.entrance.ride_index;
int32_t rideIndex = tileElement->AsEntrance()->GetRideIndex();
tileElement = map_get_first_element_at(x >> 5, y >> 5);
do
@@ -584,7 +584,7 @@ void maze_entrance_hedge_removal(int32_t x, int32_t y, rct_tile_element* tileEle
x += CoordsDirectionDelta[direction].x;
y += CoordsDirectionDelta[direction].y;
int32_t z = tileElement->base_height;
int32_t rideIndex = tileElement->properties.entrance.ride_index;
int32_t rideIndex = tileElement->AsEntrance()->GetRideIndex();
tileElement = map_get_first_element_at(x >> 5, y >> 5);
do
@@ -633,11 +633,52 @@ void fix_park_entrance_locations(void)
uint8_t EntranceElement::GetStationIndex() const
{
return (temp.index & MAP_ELEM_TRACK_SEQUENCE_STATION_INDEX_MASK) >> 4;
return (index & MAP_ELEM_TRACK_SEQUENCE_STATION_INDEX_MASK) >> 4;
}
void EntranceElement::SetStationIndex(uint8_t stationIndex)
{
temp.index &= ~MAP_ELEM_TRACK_SEQUENCE_STATION_INDEX_MASK;
temp.index |= (stationIndex << 4);
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;
}
uint8_t EntranceElement::GetRideIndex() const
{
return rideIndex;
}
void EntranceElement::SetRideIndex(uint8_t newRideIndex)
{
rideIndex = newRideIndex;
}
uint8_t EntranceElement::GetSequenceIndex() const
{
return index & 0xF;
}
void EntranceElement::SetSequenceIndex(uint8_t newSequenceIndex)
{
index &= ~0xF;
index |= (newSequenceIndex & 0xF);
}
uint8_t EntranceElement::GetPathType() const
{
return pathType;
}
void EntranceElement::SetPathType(uint8_t newPathType)
{
pathType = newPathType;
}
+25 -23
View File
@@ -98,8 +98,8 @@ 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 sequence = tileElement->properties.entrance.index & 0x0F;
uint8_t entranceType = tileElement->AsEntrance()->GetEntranceType();
uint8_t sequence = tileElement->AsEntrance()->GetSequenceIndex();
return EntranceDirections[(entranceType * 8) + sequence];
}
@@ -195,7 +195,8 @@ static constexpr const uint8_t byte_98D7EC[] = { 207, 159, 63, 111 };
static money32 footpath_element_insert(
int32_t type, int32_t x, int32_t y, int32_t z, int32_t slope, int32_t flags, uint8_t pathItemType)
{
rct_tile_element *tileElement, *entranceElement;
rct_tile_element* tileElement;
EntranceElement* entranceElement;
int32_t bl, zHigh;
bool entrancePath = false, entranceIsSamePath = false;
@@ -218,11 +219,11 @@ static money32 footpath_element_insert(
entranceElement = map_get_park_entrance_element_at(x, y, z, false);
// Make sure the entrance part is the middle
if (entranceElement != nullptr && (entranceElement->properties.entrance.index & 0x0F) == 0)
if (entranceElement != nullptr && (entranceElement->GetSequenceIndex()) == 0)
{
entrancePath = true;
// Make the price the same as replacing a path
if (entranceElement->properties.entrance.path_type == (type & 0xF))
if (entranceElement->GetPathType() == (type & 0xF))
entranceIsSamePath = true;
else
gFootpathPrice -= MONEY(6, 00);
@@ -256,7 +257,7 @@ static money32 footpath_element_insert(
if (!(flags & GAME_COMMAND_FLAG_GHOST) && !entranceIsSamePath)
{
// Set the path type but make sure it's not a queue as that will not show up
entranceElement->properties.entrance.path_type = type & 0x7F;
entranceElement->SetPathType(type & 0x7F);
map_invalidate_tile_full(x, y);
}
}
@@ -510,7 +511,7 @@ void remove_banners_at_element(int32_t x, int32_t y, rct_tile_element* tileEleme
continue;
game_do_command(
x, 1, y, tileElement->base_height | tileElement->properties.banner.position << 8, GAME_COMMAND_REMOVE_BANNER, 0, 0);
x, 1, y, tileElement->base_height | tileElement->AsBanner()->GetPosition() << 8, GAME_COMMAND_REMOVE_BANNER, 0, 0);
tileElement--;
}
}
@@ -530,7 +531,8 @@ void game_command_place_footpath(
static money32 footpath_place_from_track(
int32_t type, int32_t x, int32_t y, int32_t z, int32_t slope, int32_t edges, int32_t flags)
{
rct_tile_element *tileElement, *entranceElement;
rct_tile_element* tileElement;
EntranceElement* entranceElement;
bool entrancePath = false, entranceIsSamePath = false;
gCommandExpenditureType = RCT_EXPENDITURE_TYPE_LANDSCAPING;
@@ -589,11 +591,11 @@ static money32 footpath_place_from_track(
entranceElement = map_get_park_entrance_element_at(x, y, z, false);
// Make sure the entrance part is the middle
if (entranceElement != nullptr && (entranceElement->properties.entrance.index & 0x0F) == 0)
if (entranceElement != nullptr && (entranceElement->GetSequenceIndex()) == 0)
{
entrancePath = true;
// Make the price the same as replacing a path
if (entranceElement->properties.entrance.path_type == (type & 0xF))
if (entranceElement->GetPathType() == (type & 0xF))
entranceIsSamePath = true;
else
gFootpathPrice -= MONEY(6, 00);
@@ -636,7 +638,7 @@ static money32 footpath_place_from_track(
if (!(flags & GAME_COMMAND_FLAG_GHOST) && !entranceIsSamePath)
{
// Set the path type but make sure it's not a queue as that will not show up
entranceElement->properties.entrance.path_type = type & 0x7F;
entranceElement->SetPathType(type & 0x7F);
map_invalidate_tile_full(x, y);
}
}
@@ -1396,14 +1398,14 @@ static void loc_6A6D7E(
if (query)
{
neighbour_list_push(
neighbourList, 8, direction, tileElement->properties.entrance.ride_index,
tileElement->properties.entrance.index);
neighbourList, 8, direction, tileElement->AsEntrance()->GetRideIndex(),
tileElement->AsEntrance()->GetStationIndex());
}
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);
footpath_queue_chain_push(tileElement->AsEntrance()->GetRideIndex());
}
}
goto loc_6A6FD2;
@@ -1427,7 +1429,7 @@ static void loc_6A6D7E(
{
neighbour_list_push(
neighbourList, 4, direction, tileElement->properties.path.ride_index,
tileElement->properties.entrance.index);
tileElement->properties.path.additions);
}
else
{
@@ -1438,7 +1440,7 @@ static void loc_6A6D7E(
{
neighbour_list_push(
neighbourList, 3, direction, tileElement->properties.path.ride_index,
tileElement->properties.entrance.index);
tileElement->properties.path.additions);
}
}
}
@@ -1753,9 +1755,9 @@ 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)
if (tileElement->AsEntrance()->GetRideIndex() != rideIndex)
continue;
uint8_t direction = tileElement->GetDirectionWithOffset(2);
@@ -1879,7 +1881,7 @@ static int32_t footpath_is_connected_to_map_edge_recurse(
break;
if (tileElement[i].type != TILE_ELEMENT_TYPE_BANNER)
break;
edges &= tileElement[i].properties.banner.flags;
edges &= tileElement[i].AsBanner()->GetAllowedEdges();
}
}
if (tileElement[2].type == TILE_ELEMENT_TYPE_BANNER && tileElement[1].type != TILE_ELEMENT_TYPE_PATH)
@@ -1890,7 +1892,7 @@ static int32_t footpath_is_connected_to_map_edge_recurse(
break;
if (tileElement[i].type != TILE_ELEMENT_TYPE_BANNER)
break;
edges &= tileElement[i].properties.banner.flags;
edges &= tileElement[i].AsBanner()->GetAllowedEdges();
}
}
}
@@ -2336,9 +2338,9 @@ 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_queue_chain_push(tileElement->AsEntrance()->GetRideIndex());
footpath_chain_ride_queue(255, 0, x, y, tileElement, tileElement->GetDirectionWithOffset(2));
}
break;
+18 -22
View File
@@ -307,7 +307,7 @@ rct_tile_element* map_get_path_element_at(int32_t x, int32_t y, int32_t z)
return nullptr;
}
rct_tile_element* map_get_banner_element_at(int32_t x, int32_t y, int32_t z, uint8_t position)
BannerElement* map_get_banner_element_at(int32_t x, int32_t y, int32_t z, uint8_t position)
{
rct_tile_element* tileElement = map_get_first_element_at(x, y);
@@ -321,10 +321,10 @@ rct_tile_element* map_get_banner_element_at(int32_t x, int32_t y, int32_t z, uin
continue;
if (tileElement->base_height != z)
continue;
if (tileElement->properties.banner.position != position)
if (tileElement->AsBanner()->GetPosition() != position)
continue;
return tileElement;
return tileElement->AsBanner();
} while (!(tileElement++)->IsLastForTile());
return nullptr;
@@ -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;
@@ -3848,7 +3848,7 @@ static void clear_element_at(int32_t x, int32_t y, rct_tile_element** elementPtr
case TILE_ELEMENT_TYPE_ENTRANCE:
{
int32_t rotation = element->GetDirectionWithOffset(1);
switch (element->properties.entrance.index & 0x0F)
switch (element->AsEntrance()->GetSequenceIndex())
{
case 1:
x += CoordsDirectionDelta[rotation].x;
@@ -3880,7 +3880,7 @@ static void clear_element_at(int32_t x, int32_t y, rct_tile_element** elementPtr
case TILE_ELEMENT_TYPE_BANNER:
gGameCommandErrorTitle = STR_CANT_REMOVE_THIS;
game_do_command(
x, GAME_COMMAND_FLAG_APPLY, y, (element->base_height) | ((element->properties.banner.position & 3) << 8),
x, GAME_COMMAND_FLAG_APPLY, y, (element->base_height) | ((element->AsBanner()->GetPosition() & 3) << 8),
GAME_COMMAND_REMOVE_BANNER, 0, 0);
break;
default:
@@ -3959,7 +3959,7 @@ rct_tile_element* map_get_large_scenery_segment(int32_t x, int32_t y, int32_t z,
return nullptr;
}
rct_tile_element* map_get_park_entrance_element_at(int32_t x, int32_t y, int32_t z, bool ghost)
EntranceElement* map_get_park_entrance_element_at(int32_t x, int32_t y, int32_t z, bool ghost)
{
rct_tile_element* tileElement = map_get_first_element_at(x >> 5, y >> 5);
if (tileElement != nullptr)
@@ -3972,19 +3972,19 @@ 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))
continue;
return tileElement;
return tileElement->AsEntrance();
} while (!(tileElement++)->IsLastForTile());
}
return nullptr;
}
rct_tile_element* map_get_ride_entrance_element_at(int32_t x, int32_t y, int32_t z, bool ghost)
EntranceElement* map_get_ride_entrance_element_at(int32_t x, int32_t y, int32_t z, bool ghost)
{
rct_tile_element* tileElement = map_get_first_element_at(x >> 5, y >> 5);
if (tileElement != nullptr)
@@ -3997,19 +3997,19 @@ 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))
continue;
return tileElement;
return tileElement->AsEntrance();
} while (!(tileElement++)->IsLastForTile());
}
return nullptr;
}
rct_tile_element* map_get_ride_exit_element_at(int32_t x, int32_t y, int32_t z, bool ghost)
EntranceElement* map_get_ride_exit_element_at(int32_t x, int32_t y, int32_t z, bool ghost)
{
rct_tile_element* tileElement = map_get_first_element_at(x >> 5, y >> 5);
if (tileElement != nullptr)
@@ -4022,13 +4022,13 @@ 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))
continue;
return tileElement;
return tileElement->AsEntrance();
} while (!(tileElement++)->IsLastForTile());
}
return nullptr;
@@ -4821,7 +4821,8 @@ 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 +4852,3 @@ void FixLandOwnershipTilesWithOwnership(std::initializer_list<TileCoordsXY> 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);
}
+4 -6
View File
@@ -135,15 +135,15 @@ rct_tile_element* map_get_first_element_at(int32_t x, int32_t y);
rct_tile_element* map_get_nth_element_at(int32_t x, int32_t y, int32_t n);
void map_set_tile_elements(int32_t x, int32_t y, rct_tile_element* elements);
int32_t map_height_from_slope(int32_t x, int32_t y, int32_t slope);
rct_tile_element* map_get_banner_element_at(int32_t x, int32_t y, int32_t z, uint8_t direction);
BannerElement* map_get_banner_element_at(int32_t x, int32_t y, int32_t z, uint8_t direction);
rct_tile_element* map_get_surface_element_at(int32_t x, int32_t y);
rct_tile_element* map_get_surface_element_at(CoordsXY coords);
rct_tile_element* map_get_path_element_at(int32_t x, int32_t y, int32_t z);
rct_tile_element* map_get_wall_element_at(int32_t x, int32_t y, int32_t z, int32_t direction);
rct_tile_element* map_get_small_scenery_element_at(int32_t x, int32_t y, int32_t z, int32_t type, uint8_t quadrant);
rct_tile_element* map_get_park_entrance_element_at(int32_t x, int32_t y, int32_t z, bool ghost);
rct_tile_element* map_get_ride_entrance_element_at(int32_t x, int32_t y, int32_t z, bool ghost);
rct_tile_element* map_get_ride_exit_element_at(int32_t x, int32_t y, int32_t z, bool ghost);
EntranceElement* map_get_park_entrance_element_at(int32_t x, int32_t y, int32_t z, bool ghost);
EntranceElement* map_get_ride_entrance_element_at(int32_t x, int32_t y, int32_t z, bool ghost);
EntranceElement* map_get_ride_exit_element_at(int32_t x, int32_t y, int32_t z, bool ghost);
int32_t tile_element_height(int32_t x, int32_t y);
bool map_coord_is_connected(int32_t x, int32_t y, int32_t z, uint8_t faceDirection);
void map_remove_provisional_elements();
@@ -297,6 +297,4 @@ void FixLandOwnershipTilesWithOwnership(std::initializer_list<TileCoordsXY> tile
bool place_peep_spawn(CoordsXYZD location);
uint8_t entrance_element_get_type(const rct_tile_element* tileElement);
#endif
+4 -4
View File
@@ -114,10 +114,10 @@ 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);
ride = get_ride(tileElement->AsEntrance()->GetRideIndex());
entranceDefinition = &RideEntranceDefinitions[ride->entrance_style];
int32_t height = (tileElement->base_height * 8) + entranceDefinition->height + 8;
@@ -246,9 +246,9 @@ 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)
if (tileElement->AsEntrance()->GetSequenceIndex())
continue;
baseZ = tileElement->base_height * 8;
+1 -1
View File
@@ -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))
+8 -3
View File
@@ -84,7 +84,7 @@ BannerIndex tile_element_get_banner_index(rct_tile_element* tileElement)
return tileElement->AsWall()->GetBannerIndex();
case TILE_ELEMENT_TYPE_BANNER:
return tileElement->properties.banner.index;
return tileElement->AsBanner()->GetIndex();
default:
return BANNER_INDEX_NULL;
}
@@ -101,7 +101,7 @@ void tile_element_set_banner_index(rct_tile_element* tileElement, BannerIndex ba
tileElement->AsLargeScenery()->SetBannerIndex(bannerIndex);
break;
case TILE_ELEMENT_TYPE_BANNER:
tileElement->properties.banner.index = bannerIndex;
tileElement->AsBanner()->SetIndex(bannerIndex);
break;
default:
log_error("Tried to set banner index on unsuitable tile element!");
@@ -132,7 +132,7 @@ uint8_t tile_element_get_ride_index(const rct_tile_element* tileElement)
case TILE_ELEMENT_TYPE_TRACK:
return tileElement->AsTrack()->GetRideIndex();
case TILE_ELEMENT_TYPE_ENTRANCE:
return tileElement->properties.entrance.ride_index;
return tileElement->AsEntrance()->GetRideIndex();
case TILE_ELEMENT_TYPE_PATH:
return tileElement->properties.path.ride_index;
default:
@@ -148,3 +148,8 @@ void rct_tile_element::ClearAs(uint8_t newType)
clearance_height = 2;
memset(pad_04, 0, sizeof(pad_04));
}
void TileElementBase::Remove()
{
tile_element_remove((rct_tile_element*)this);
}
+36 -22
View File
@@ -28,29 +28,9 @@ struct rct_tile_element_path_properties
};
assert_struct_size(rct_tile_element_path_properties, 4);
struct rct_tile_element_entrance_properties
{
uint8_t type; // 4
uint8_t index; // 5
uint8_t path_type; // 6
uint8_t ride_index; // 7
};
assert_struct_size(rct_tile_element_entrance_properties, 4);
struct rct_tile_element_banner_properties
{
BannerIndex index; // 4
uint8_t position; // 5
uint8_t flags; // 6
uint8_t unused; // 7
};
assert_struct_size(rct_tile_element_banner_properties, 4);
union rct_tile_element_properties
{
rct_tile_element_path_properties path;
rct_tile_element_entrance_properties entrance;
rct_tile_element_banner_properties banner;
};
assert_struct_size(rct_tile_element_properties, 4);
@@ -106,6 +86,7 @@ struct TileElementBase
uint8_t GetDirectionWithOffset(uint8_t offset) const;
bool IsLastForTile() const;
bool IsGhost() const;
void Remove();
};
/**
@@ -374,17 +355,50 @@ assert_struct_size(WallElement, 8);
struct EntranceElement : TileElementBase
{
rct_tile_element_entrance_properties temp;
private:
uint8_t entranceType; // 4
uint8_t index; // 5. 0bUSSS????, S = station index.
uint8_t pathType; // 6
uint8_t rideIndex; // 7
public:
uint8_t GetEntranceType() const;
void SetEntranceType(uint8_t newType);
uint8_t GetRideIndex() const;
void SetRideIndex(uint8_t newRideIndex);
uint8_t GetStationIndex() const;
void SetStationIndex(uint8_t stationIndex);
uint8_t GetSequenceIndex() const;
void SetSequenceIndex(uint8_t newSequenceIndex);
uint8_t GetPathType() const;
void SetPathType(uint8_t newPathType);
};
assert_struct_size(EntranceElement, 8);
struct BannerElement : TileElementBase
{
rct_tile_element_banner_properties temp;
private:
BannerIndex index; // 4
uint8_t position; // 5
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"
uint8_t flags; // 6
uint8_t unused; // 7
#pragma clang diagnostic pop
public:
BannerIndex GetIndex() const;
void SetIndex(BannerIndex newIndex);
uint8_t GetPosition() const;
void SetPosition(uint8_t newPosition);
uint8_t GetAllowedEdges() const;
void SetAllowedEdges(uint8_t newEdges);
void ResetAllowedEdges();
};
assert_struct_size(BannerElement, 8);
+15 -15
View File
@@ -241,11 +241,11 @@ int32_t tile_inspector_rotate_element_at(int32_t x, int32_t y, int32_t elementIn
tileElement->SetDirection(newRotation);
// Update ride's known entrance/exit rotation
Ride* ride = get_ride(tileElement->properties.entrance.ride_index);
uint8_t stationIndex = tileElement->properties.entrance.index;
Ride* ride = get_ride(tileElement->AsEntrance()->GetRideIndex());
uint8_t stationIndex = tileElement->AsEntrance()->GetStationIndex();
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
@@ -267,12 +267,10 @@ int32_t tile_inspector_rotate_element_at(int32_t x, int32_t y, int32_t elementIn
break;
case TILE_ELEMENT_TYPE_BANNER:
{
uint8_t unblockedEdges = tileElement->properties.banner.flags & 0xF;
uint8_t unblockedEdges = tileElement->AsBanner()->GetAllowedEdges();
unblockedEdges = (unblockedEdges << 1 | unblockedEdges >> 3) & 0xF;
tileElement->properties.banner.flags &= ~0xF;
tileElement->properties.banner.flags |= unblockedEdges;
tileElement->properties.banner.position++;
tileElement->properties.banner.position &= 3;
tileElement->AsBanner()->SetAllowedEdges(unblockedEdges);
tileElement->AsBanner()->SetPosition((tileElement->AsBanner()->GetPosition() + 1) & 3);
break;
}
}
@@ -437,12 +435,12 @@ 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
Ride* ride = get_ride(tileElement->properties.entrance.ride_index);
uint8_t entranceIndex = tileElement->properties.entrance.index;
Ride* ride = get_ride(tileElement->AsEntrance()->GetRideIndex());
uint8_t entranceIndex = tileElement->AsEntrance()->GetStationIndex();
auto entrance = ride_get_entrance_location(ride, entranceIndex);
auto exit = ride_get_exit_location(ride, entranceIndex);
uint8_t z = tileElement->base_height;
@@ -664,16 +662,16 @@ int32_t tile_inspector_entrance_make_usable(int32_t x, int32_t y, int32_t elemen
if (entranceElement == nullptr || entranceElement->GetType() != TILE_ELEMENT_TYPE_ENTRANCE)
return MONEY32_UNDEFINED;
Ride* ride = get_ride(entranceElement->properties.entrance.ride_index);
Ride* ride = get_ride(entranceElement->AsEntrance()->GetRideIndex());
if (ride == nullptr)
return MONEY32_UNDEFINED;
if (flags & GAME_COMMAND_FLAG_APPLY)
{
uint8_t stationIndex = entranceElement->properties.entrance.index >> 6;
uint8_t stationIndex = entranceElement->AsEntrance()->GetStationIndex();
switch (entranceElement->properties.entrance.type)
switch (entranceElement->AsEntrance()->GetEntranceType())
{
case ENTRANCE_TYPE_RIDE_ENTRANCE:
ride_set_entrance_location(
@@ -1038,7 +1036,9 @@ int32_t tile_inspector_banner_toggle_blocking_edge(int32_t x, int32_t y, int32_t
if (flags & GAME_COMMAND_FLAG_APPLY)
{
bannerElement->properties.banner.flags ^= 1 << edgeIndex;
uint8_t edges = bannerElement->AsBanner()->GetAllowedEdges();
edges ^= (1 << edgeIndex);
bannerElement->AsBanner()->SetAllowedEdges(edges);
if ((uint32_t)x == windowTileInspectorTileX && (uint32_t)y == windowTileInspectorTileY)
{
+2 -2
View File
@@ -88,7 +88,7 @@ TEST_F(TileElementWantsFootpathConnection, Stall)
TEST_F(TileElementWantsFootpathConnection, RideEntrance)
{
// Ride entrances and exits want a connection in one direction
const rct_tile_element* const entranceElement = map_get_ride_entrance_element_at(18 << 5, 8 << 5, 14, false);
const EntranceElement* const entranceElement = map_get_ride_entrance_element_at(18 << 5, 8 << 5, 14, false);
ASSERT_NE(entranceElement, nullptr);
EXPECT_TRUE(tile_element_wants_path_connection_towards({ 18, 8, 14, 0 }, nullptr));
EXPECT_FALSE(tile_element_wants_path_connection_towards({ 18, 8, 14, 1 }, nullptr));
@@ -100,7 +100,7 @@ TEST_F(TileElementWantsFootpathConnection, RideEntrance)
TEST_F(TileElementWantsFootpathConnection, RideExit)
{
// The exit has been rotated; it wants a path connection in direction 1, but not 0 like the entrance
const rct_tile_element* const exitElement = map_get_ride_exit_element_at(18 << 5, 10 << 5, 14, false);
const EntranceElement* const exitElement = map_get_ride_exit_element_at(18 << 5, 10 << 5, 14, false);
ASSERT_NE(exitElement, nullptr);
EXPECT_FALSE(tile_element_wants_path_connection_towards({ 18, 10, 14, 0 }, nullptr));
EXPECT_TRUE(tile_element_wants_path_connection_towards({ 18, 10, 14, 1 }, nullptr));