1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-15 19:13:07 +01:00

Replace C-style functions for getting direction

This commit is contained in:
Gymnasiast
2018-09-16 17:24:49 +02:00
committed by Michael Steenbeek
parent 015ece94c6
commit a6885ea464
6 changed files with 13 additions and 13 deletions

View File

@@ -409,7 +409,7 @@ static void sub_6A4101(
return;
}
uint8_t direction = footpath_element_get_direction(tile_element);
uint8_t direction = tile_element->AsPath()->GetQueueBannerDirection();
// Draw ride sign
session->InteractionType = VIEWPORT_INTERACTION_ITEM_RIDE;
if (tile_element->AsPath()->IsSloped())

View File

@@ -2929,7 +2929,7 @@ static void peep_interact_with_path(rct_peep* peep, int16_t x, int16_t y, rct_ti
uint8_t stationNum = (tile_element->properties.path.additions & 0x70) >> 4;
if ((tile_element->properties.path.type & (1 << 3)) // Queue has the ride sign on it
&& (footpath_element_get_direction(tile_element)
&& (tile_element->AsPath()->GetQueueBannerDirection()
== ((peep->direction) ^ 2)) // Ride sign is facing the direction the peep is walking
)
{

View File

@@ -1701,8 +1701,7 @@ void footpath_chain_ride_queue(
if (lastPathElement->AsPath()->IsQueue())
{
lastPathElement->properties.path.type |= FOOTPATH_PROPERTIES_FLAG_HAS_QUEUE_BANNER;
lastPathElement->type &= 0x3F; // Clear the ride sign direction
footpath_element_set_direction(lastPathElement, lastPathDirection); // set the ride sign direction
lastPathElement->AsPath()->SetQueueBannerDirection(lastPathDirection); // set the ride sign direction
map_animation_create(MAP_ANIMATION_TYPE_QUEUE_BANNER, lastPathX, lastPathY, lastPathElement->base_height);
}
@@ -2058,15 +2057,15 @@ void PathElement::SetEntryIndex(uint8_t newEntryIndex)
entryIndex |= (newEntryIndex << 4);
}
uint8_t footpath_element_get_direction(const rct_tile_element* tileElement)
uint8_t PathElement::GetQueueBannerDirection() const
{
return ((tileElement->type & FOOTPATH_ELEMENT_TYPE_DIRECTION_MASK) >> 6);
return ((type & FOOTPATH_ELEMENT_TYPE_DIRECTION_MASK) >> 6);
}
void footpath_element_set_direction(rct_tile_element* tileElement, uint8_t direction)
void PathElement::SetQueueBannerDirection(uint8_t direction)
{
tileElement->type &= ~FOOTPATH_ELEMENT_TYPE_DIRECTION_MASK;
tileElement->type |= (direction << 6);
type &= ~FOOTPATH_ELEMENT_TYPE_DIRECTION_MASK;
type |= (direction << 6);
}
/**

View File

@@ -155,8 +155,6 @@ bool footpath_is_blocked_by_vehicle(const TileCoordsXYZ& position);
int32_t footpath_is_connected_to_map_edge(int32_t x, int32_t y, int32_t z, int32_t direction, int32_t flags);
uint8_t footpath_element_get_slope_direction(const rct_tile_element* tileElement);
uint8_t footpath_element_get_direction(const rct_tile_element* tileElement);
void footpath_element_set_direction(rct_tile_element* tileElement, uint8_t direction);
void footpath_remove_edges_at(int32_t x, int32_t y, rct_tile_element* tileElement);
int32_t entrance_get_directions(const rct_tile_element* tileElement);

View File

@@ -148,7 +148,7 @@ static bool map_animation_invalidate_queue_banner(int32_t x, int32_t y, int32_t
if (!tileElement->AsPath()->HasQueueBanner())
continue;
int32_t direction = (footpath_element_get_direction(tileElement) + get_current_rotation()) & 3;
int32_t direction = (tileElement->AsPath()->GetQueueBannerDirection() + get_current_rotation()) & 3;
if (direction == TILE_ELEMENT_DIRECTION_NORTH || direction == TILE_ELEMENT_DIRECTION_EAST)
{
baseZ = tileElement->base_height * 8;

View File

@@ -201,7 +201,10 @@ public:
uint8_t GetEntryIndex() const;
rct_footpath_entry* GetEntry() const;
void SetEntryIndex(uint8_t newIndex);
uint8_t GetQueueBannerDirection() const;
void SetQueueBannerDirection(uint8_t direction);
bool IsSloped() const;
void SetSloped(bool isSloped);