forked from rosebudai/OpenRCT2-Web
Reduce usage of GetDirectionWithOffset()
GetDirectionWithOffset(2) is the same thing as 'direction_reverse(GetDirection())', and the latter is more readable.
This commit is contained in:
1 parent
6449393d50
commit
5ff78e48c7
8 files changed
+15
-15
No files matched your search
@@ -557,7 +557,7 @@ private:
|
||||
{
|
||||
if (!(TrackCoordinates[trackType].rotation_begin & 4))
|
||||
{
|
||||
direction = trackElement->GetDirectionWithOffset(2);
|
||||
direction = direction_reverse(trackElement->GetDirection());
|
||||
if (direction == _edge)
|
||||
{
|
||||
const rct_preview_track* trackBlock = &TrackBlocks[trackType][sequence];
|
||||
|
||||
@@ -248,7 +248,7 @@ static void sub_68B3FB(paint_session* session, int32_t x, int32_t y)
|
||||
if ((session->ViewFlags & VIEWPORT_FLAG_CLIP_VIEW) && (tile_element->base_height > gClipHeight))
|
||||
continue;
|
||||
|
||||
int32_t direction = tile_element->GetDirectionWithOffset(rotation);
|
||||
Direction direction = tile_element->GetDirectionWithOffset(rotation);
|
||||
int32_t height = tile_element->base_height * 8;
|
||||
|
||||
// If we are on a new height level, look through elements on the
|
||||
|
||||
@@ -6472,7 +6472,7 @@ static bool peep_find_ride_to_look_at(Peep* peep, uint8_t edge, uint8_t* rideToV
|
||||
}
|
||||
if (tileElement->GetType() != TILE_ELEMENT_TYPE_WALL)
|
||||
continue;
|
||||
if (tileElement->GetDirectionWithOffset(2) != edge)
|
||||
if (direction_reverse(tileElement->GetDirection()) != edge)
|
||||
continue;
|
||||
auto wallEntry = tileElement->AsWall()->GetEntry();
|
||||
if (wallEntry == nullptr || (wallEntry->wall.flags2 & WALL_SCENERY_2_IS_OPAQUE))
|
||||
@@ -6590,7 +6590,7 @@ static bool peep_find_ride_to_look_at(Peep* peep, uint8_t edge, uint8_t* rideToV
|
||||
}
|
||||
if (tileElement->GetType() != TILE_ELEMENT_TYPE_WALL)
|
||||
continue;
|
||||
if (tileElement->GetDirectionWithOffset(2) != edge)
|
||||
if (direction_reverse(tileElement->GetDirection()) != edge)
|
||||
continue;
|
||||
auto wallEntry = tileElement->AsWall()->GetEntry();
|
||||
if (wallEntry == nullptr || (wallEntry->wall.flags2 & WALL_SCENERY_2_IS_OPAQUE))
|
||||
@@ -6706,7 +6706,7 @@ static bool peep_find_ride_to_look_at(Peep* peep, uint8_t edge, uint8_t* rideToV
|
||||
}
|
||||
if (tileElement->GetType() != TILE_ELEMENT_TYPE_WALL)
|
||||
continue;
|
||||
if (tileElement->GetDirectionWithOffset(2) != edge)
|
||||
if (direction_reverse(tileElement->GetDirection()) != edge)
|
||||
continue;
|
||||
auto wallEntry = tileElement->AsWall()->GetEntry();
|
||||
if (wallEntry == nullptr || (wallEntry->wall.flags2 & WALL_SCENERY_2_IS_OPAQUE))
|
||||
|
||||
@@ -1740,7 +1740,7 @@ static void get_ride_queue_end(TileCoordsXYZ& loc)
|
||||
if (!found)
|
||||
return;
|
||||
|
||||
Direction direction = tileElement->GetDirectionWithOffset(2);
|
||||
Direction direction = direction_reverse(tileElement->GetDirection());
|
||||
TileElement* lastPathElement = nullptr;
|
||||
TileElement* firstPathElement = nullptr;
|
||||
|
||||
|
||||
@@ -7078,7 +7078,7 @@ void sub_6CB945(Ride* ride)
|
||||
uint8_t trackType = trackElement->AsTrack()->GetTrackType();
|
||||
uint8_t trackSequence = trackElement->AsTrack()->GetSequenceIndex();
|
||||
|
||||
uint8_t direction = (tileElement->GetDirection() - trackElement->GetDirectionWithOffset(2)) & 3;
|
||||
Direction direction = (tileElement->GetDirection() - direction_reverse(trackElement->GetDirection())) & 3;
|
||||
|
||||
if (!(TrackSequenceProperties[trackType][trackSequence] & (1 << direction)))
|
||||
{
|
||||
|
||||
@@ -1198,7 +1198,7 @@ void footpath_update_queue_chains()
|
||||
if (tileElement->AsEntrance()->GetRideIndex() != rideIndex)
|
||||
continue;
|
||||
|
||||
uint8_t direction = tileElement->GetDirectionWithOffset(2);
|
||||
Direction direction = direction_reverse(tileElement->GetDirection());
|
||||
footpath_chain_ride_queue(rideIndex, i, location.x << 5, location.y << 5, tileElement, direction);
|
||||
} while (!(tileElement++)->IsLastForTile());
|
||||
}
|
||||
@@ -1877,7 +1877,7 @@ void footpath_update_queue_entrance_banner(int32_t x, int32_t y, TileElement* ti
|
||||
if (tileElement->AsEntrance()->GetEntranceType() == ENTRANCE_TYPE_RIDE_ENTRANCE)
|
||||
{
|
||||
footpath_queue_chain_push(tileElement->AsEntrance()->GetRideIndex());
|
||||
footpath_chain_ride_queue(255, 0, x, y, tileElement, tileElement->GetDirectionWithOffset(2));
|
||||
footpath_chain_ride_queue(255, 0, x, y, tileElement, direction_reverse(tileElement->GetDirection()));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -28,18 +28,18 @@ void TileElementBase::SetType(uint8_t newType)
|
||||
this->type |= (newType & TILE_ELEMENT_TYPE_MASK);
|
||||
}
|
||||
|
||||
uint8_t TileElementBase::GetDirection() const
|
||||
Direction TileElementBase::GetDirection() const
|
||||
{
|
||||
return this->type & TILE_ELEMENT_DIRECTION_MASK;
|
||||
}
|
||||
|
||||
void TileElementBase::SetDirection(uint8_t direction)
|
||||
void TileElementBase::SetDirection(Direction direction)
|
||||
{
|
||||
this->type &= ~TILE_ELEMENT_DIRECTION_MASK;
|
||||
this->type |= (direction & TILE_ELEMENT_DIRECTION_MASK);
|
||||
}
|
||||
|
||||
uint8_t TileElementBase::GetDirectionWithOffset(uint8_t offset) const
|
||||
Direction TileElementBase::GetDirectionWithOffset(uint8_t offset) const
|
||||
{
|
||||
return ((this->type & TILE_ELEMENT_DIRECTION_MASK) + offset) & TILE_ELEMENT_DIRECTION_MASK;
|
||||
}
|
||||
|
||||
@@ -67,9 +67,9 @@ struct TileElementBase
|
||||
|
||||
uint8_t GetType() const;
|
||||
void SetType(uint8_t newType);
|
||||
uint8_t GetDirection() const;
|
||||
void SetDirection(uint8_t direction);
|
||||
uint8_t GetDirectionWithOffset(uint8_t offset) const;
|
||||
Direction GetDirection() const;
|
||||
void SetDirection(Direction direction);
|
||||
Direction GetDirectionWithOffset(uint8_t offset) const;
|
||||
bool IsLastForTile() const;
|
||||
void SetLastForTile(bool on);
|
||||
bool IsGhost() const;
|
||||
|
||||
Reference in new issue
Block a user