Remove snake cases from Location and LargeScenery

This commit is contained in:
duncanspumpkin 2022-10-04 20:12:38 +01:00
parent 8ea34a5360
commit 2a593b6029
33 changed files with 145 additions and 149 deletions

View File

@ -1150,7 +1150,7 @@ static void FootpathRemoveTileElement(TileElement* tileElement)
if (tileElement->AsPath()->IsSloped())
{
uint8_t slopeDirection = tileElement->AsPath()->GetSlopeDirection();
slopeDirection = direction_reverse(slopeDirection);
slopeDirection = DirectionReverse(slopeDirection);
if (slopeDirection == _footpathConstructDirection)
{
z += PATH_HEIGHT_STEP;
@ -1158,7 +1158,7 @@ static void FootpathRemoveTileElement(TileElement* tileElement)
}
// Find a connected edge
int32_t edge = direction_reverse(_footpathConstructDirection);
int32_t edge = DirectionReverse(_footpathConstructDirection);
if (!(tileElement->AsPath()->GetEdges() & (1 << edge)))
{
edge = (edge + 1) & 3;
@ -1170,7 +1170,7 @@ static void FootpathRemoveTileElement(TileElement* tileElement)
edge = (edge - 1) & 3;
if (!(tileElement->AsPath()->GetEdges() & (1 << edge)))
{
edge = direction_reverse(edge);
edge = DirectionReverse(edge);
}
}
}
@ -1181,7 +1181,7 @@ static void FootpathRemoveTileElement(TileElement* tileElement)
GameActions::Execute(&action);
// Move selection
edge = direction_reverse(edge);
edge = DirectionReverse(edge);
gFootpathConstructFromPosition.x -= CoordsDirectionDelta[edge].x;
gFootpathConstructFromPosition.y -= CoordsDirectionDelta[edge].y;
gFootpathConstructFromPosition.z = z;
@ -1217,7 +1217,7 @@ static TileElement* FootpathGetTileElementToRemove()
{
if (tileElement->AsPath()->IsSloped())
{
if (direction_reverse(tileElement->AsPath()->GetSlopeDirection()) != _footpathConstructDirection)
if (DirectionReverse(tileElement->AsPath()->GetSlopeDirection()) != _footpathConstructDirection)
{
continue;
}

View File

@ -569,7 +569,7 @@ public:
gMapSelectPositionA = mapCoords;
gMapSelectPositionB = mapCoords;
gMapSelectArrowPosition = CoordsXYZ{ mapCoords, mapZ };
gMapSelectArrowDirection = direction_reverse(direction);
gMapSelectArrowDirection = DirectionReverse(direction);
map_invalidate_selection_rect();
}

View File

@ -348,7 +348,7 @@ private:
RideId rideIndex = gRideEntranceExitPlaceRideIndex;
auto rideEntranceExitPlaceAction = RideEntranceExitPlaceAction(
entranceOrExitCoords, direction_reverse(entranceOrExitCoords.direction), rideIndex,
entranceOrExitCoords, DirectionReverse(entranceOrExitCoords.direction), rideIndex,
gRideEntranceExitPlaceStationIndex, gRideEntranceExitPlaceType == ENTRANCE_TYPE_RIDE_EXIT);
rideEntranceExitPlaceAction.SetCallback([=](const GameAction* ga, const GameActions::Result* result) {

View File

@ -2552,7 +2552,7 @@ private:
return;
auto rideEntranceExitPlaceAction = RideEntranceExitPlaceAction(
entranceOrExitCoords, direction_reverse(gRideEntranceExitPlaceDirection), gRideEntranceExitPlaceRideIndex,
entranceOrExitCoords, DirectionReverse(gRideEntranceExitPlaceDirection), gRideEntranceExitPlaceRideIndex,
gRideEntranceExitPlaceStationIndex, gRideEntranceExitPlaceType == ENTRANCE_TYPE_RIDE_EXIT);
rideEntranceExitPlaceAction.SetCallback([=](const GameAction* ga, const GameActions::Result* result) {
@ -2877,7 +2877,7 @@ static void RideConstructPlacedBackwardGameActionCallback(const GameAction* ga,
auto ride = get_ride(_currentRideIndex);
if (ride != nullptr)
{
auto trackDirection = direction_reverse(_currentTrackPieceDirection);
auto trackDirection = DirectionReverse(_currentTrackPieceDirection);
auto trackPos = _currentTrackBegin;
if (!(trackDirection & 4))
{
@ -3133,7 +3133,7 @@ void UpdateGhostTrackAndArrow()
if (direction >= 4)
direction += 4;
if (_rideConstructionState == RideConstructionState::Back)
direction = direction_reverse(direction);
direction = DirectionReverse(direction);
gMapSelectArrowPosition = trackPos;
gMapSelectArrowDirection = direction;
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW;
@ -3378,7 +3378,7 @@ void ride_construction_toolupdate_construct(const ScreenCoordsXY& screenCoords)
if (pathsByDir[i] != nullptr
&& (!(pathsByDir[i])->AsPath()->IsSloped()
|| (pathsByDir[i])->AsPath()->GetSlopeDirection() != direction_reverse(i)))
|| (pathsByDir[i])->AsPath()->GetSlopeDirection() != DirectionReverse(i)))
{
pathsByDir[i] = nullptr;
}
@ -3442,10 +3442,10 @@ void ride_construction_toolupdate_entrance_exit(const ScreenCoordsXY& screenCoor
gMapSelectPositionA = entranceOrExitCoords;
gMapSelectPositionB = entranceOrExitCoords;
gMapSelectArrowPosition = entranceOrExitCoords;
gMapSelectArrowDirection = direction_reverse(entranceOrExitCoords.direction);
gMapSelectArrowDirection = DirectionReverse(entranceOrExitCoords.direction);
map_invalidate_selection_rect();
entranceOrExitCoords.direction = direction_reverse(gRideEntranceExitPlaceDirection);
entranceOrExitCoords.direction = DirectionReverse(gRideEntranceExitPlaceDirection);
StationIndex stationNum = gRideEntranceExitPlaceStationIndex;
if (!(_currentTrackSelectionFlags & TRACK_SELECTION_FLAG_ENTRANCE_OR_EXIT)
|| entranceOrExitCoords != gRideEntranceExitGhostPosition || stationNum != gRideEntranceExitGhostStationIndex)

View File

@ -416,7 +416,7 @@ public:
}
else if (tabSelectedScenery.SceneryType == SCENERY_TYPE_LARGE)
{
gCurrentToolId = static_cast<Tool>(get_large_scenery_entry(tabSelectedScenery.EntryIndex)->tool_id);
gCurrentToolId = static_cast<Tool>(GetLargeSceneryEntry(tabSelectedScenery.EntryIndex)->tool_id);
}
else if (tabSelectedScenery.SceneryType == SCENERY_TYPE_WALL)
{
@ -572,7 +572,7 @@ public:
}
else if (tabSelectedScenery.SceneryType == SCENERY_TYPE_LARGE)
{
auto* sceneryEntry = get_large_scenery_entry(tabSelectedScenery.EntryIndex);
auto* sceneryEntry = GetLargeSceneryEntry(tabSelectedScenery.EntryIndex);
if (sceneryEntry->flags & LARGE_SCENERY_FLAG_HAS_PRIMARY_COLOUR)
widgets[WIDX_SCENERY_PRIMARY_COLOUR_BUTTON].type = WindowWidgetType::ColourBtn;
@ -785,7 +785,7 @@ public:
// large scenery
for (ObjectEntryIndex sceneryId = 0; sceneryId < MAX_LARGE_SCENERY_OBJECTS; sceneryId++)
{
const auto* sceneryEntry = get_large_scenery_entry(sceneryId);
const auto* sceneryEntry = GetLargeSceneryEntry(sceneryId);
if (sceneryEntry != nullptr)
{
InitSceneryEntry({ SCENERY_TYPE_LARGE, sceneryId }, sceneryEntry->scenery_tab_id);
@ -1151,7 +1151,7 @@ private:
}
case SCENERY_TYPE_LARGE:
{
auto* sceneryEntry = get_large_scenery_entry(selectedScenery.EntryIndex);
auto* sceneryEntry = GetLargeSceneryEntry(selectedScenery.EntryIndex);
if (sceneryEntry != nullptr)
{
price = sceneryEntry->price;
@ -1200,7 +1200,7 @@ private:
}
else if (scenerySelection.SceneryType == SCENERY_TYPE_LARGE)
{
auto sceneryEntry = get_large_scenery_entry(scenerySelection.EntryIndex);
auto sceneryEntry = GetLargeSceneryEntry(scenerySelection.EntryIndex);
auto imageId = ImageId(sceneryEntry->image + gWindowSceneryRotation);
if (sceneryEntry->flags & LARGE_SCENERY_FLAG_HAS_PRIMARY_COLOUR)
imageId = imageId.WithPrimary(gWindowSceneryPrimaryColour);

View File

@ -260,7 +260,7 @@ public:
}
else
{
auto* sceneryEntry = get_large_scenery_entry(_sceneryEntry);
auto* sceneryEntry = GetLargeSceneryEntry(_sceneryEntry);
main_colour_btn->type = WindowWidgetType::Empty;
text_colour_btn->type = WindowWidgetType::Empty;

View File

@ -1459,7 +1459,7 @@ public:
{ colours[1] });
// Banner info
auto* largeSceneryEntry = get_large_scenery_entry(largeSceneryType);
auto* largeSceneryEntry = GetLargeSceneryEntry(largeSceneryType);
if (largeSceneryEntry != nullptr && largeSceneryEntry->scrolling_mode != SCROLLING_MODE_NONE)
{
auto banner = sceneryElement->GetBanner();

View File

@ -1128,7 +1128,7 @@ static void SceneryEyedropperToolDown(const ScreenCoordsXY& windowPos, WidgetInd
case ViewportInteractionItem::LargeScenery:
{
auto entryIndex = info.Element->AsLargeScenery()->GetEntryIndex();
auto* sceneryEntry = get_large_scenery_entry(entryIndex);
auto* sceneryEntry = GetLargeSceneryEntry(entryIndex);
if (sceneryEntry != nullptr)
{
WindowScenerySetSelectedItem(
@ -1573,7 +1573,7 @@ static void Sub6E1F34LargeScenery(
auto screenPos = sourceScreenPos;
uint16_t maxPossibleHeight = ZoomLevel::max().ApplyTo(std::numeric_limits<decltype(TileElement::base_height)>::max() - 32);
auto* sceneryEntry = get_large_scenery_entry(sceneryIndex);
auto* sceneryEntry = GetLargeSceneryEntry(sceneryIndex);
if (sceneryEntry)
{
int16_t maxClearZ = 0;
@ -1692,7 +1692,7 @@ static void Sub6E1F34Banner(
if (info.Element->AsPath()->IsSloped())
{
if (rotation != direction_reverse(info.Element->AsPath()->GetSlopeDirection()))
if (rotation != DirectionReverse(info.Element->AsPath()->GetSlopeDirection()))
{
z += (2 * COORDS_Z_STEP);
}
@ -2817,7 +2817,7 @@ static void TopToolbarToolUpdateScenery(const ScreenCoordsXY& screenPos)
return;
}
auto* sceneryEntry = get_large_scenery_entry(selection.EntryIndex);
auto* sceneryEntry = GetLargeSceneryEntry(selection.EntryIndex);
gMapSelectionTiles.clear();
for (rct_large_scenery_tile* tile = sceneryEntry->tiles;

View File

@ -543,7 +543,7 @@ namespace Editor
for (const auto& parkEntrance : gParkEntrances)
{
int32_t direction = direction_reverse(parkEntrance.direction);
int32_t direction = DirectionReverse(parkEntrance.direction);
switch (FootpathIsConnectedToMapEdge(parkEntrance, direction, 0))
{

View File

@ -96,7 +96,7 @@ GameActions::Result FootpathPlaceAction::Query() const
return GameActions::Result(GameActions::Status::Disallowed, STR_CANT_BUILD_FOOTPATH_HERE, STR_TOO_HIGH);
}
if (_direction != INVALID_DIRECTION && !direction_valid(_direction))
if (_direction != INVALID_DIRECTION && !DirectionValid(_direction))
{
log_error("Direction invalid. direction = %u", _direction);
return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_BUILD_FOOTPATH_HERE, STR_NONE);
@ -137,7 +137,7 @@ GameActions::Result FootpathPlaceAction::Execute() const
auto zHigh = zLow + PATH_CLEARANCE;
wall_remove_intersecting_walls(
{ _loc, zLow, zHigh + ((_slope & TILE_ELEMENT_SURFACE_RAISED_CORNERS_MASK) ? 16 : 0) },
direction_reverse(_direction));
DirectionReverse(_direction));
wall_remove_intersecting_walls(
{ _loc.x - CoordsDirectionDelta[_direction].x, _loc.y - CoordsDirectionDelta[_direction].y, zLow, zHigh },
_direction);
@ -489,7 +489,7 @@ void FootpathPlaceAction::RemoveIntersectingWalls(PathElement* pathElement) cons
{
auto direction = pathElement->GetSlopeDirection();
int32_t z = pathElement->GetBaseZ();
wall_remove_intersecting_walls({ _loc, z, z + (6 * COORDS_Z_STEP) }, direction_reverse(direction));
wall_remove_intersecting_walls({ _loc, z, z + (6 * COORDS_Z_STEP) }, DirectionReverse(direction));
wall_remove_intersecting_walls({ _loc, z, z + (6 * COORDS_Z_STEP) }, direction);
// Removing walls may have made the pointer invalid, so find it again
auto tileElement = MapGetFootpathElement(CoordsXYZ(_loc, z));

View File

@ -79,7 +79,7 @@ GameActions::Result LargeSceneryPlaceAction::Query() const
return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_NONE);
}
auto* sceneryEntry = get_large_scenery_entry(_sceneryType);
auto* sceneryEntry = GetLargeSceneryEntry(_sceneryType);
if (sceneryEntry == nullptr)
{
log_error("Invalid game command for scenery placement, sceneryType = %u", _sceneryType);
@ -191,7 +191,7 @@ GameActions::Result LargeSceneryPlaceAction::Execute() const
money32 supportsCost = 0;
auto* sceneryEntry = get_large_scenery_entry(_sceneryType);
auto* sceneryEntry = GetLargeSceneryEntry(_sceneryType);
if (sceneryEntry == nullptr)
{
log_error("Invalid game command for scenery placement, sceneryType = %u", _sceneryType);

View File

@ -82,7 +82,7 @@ GameActions::Result TrackPlaceAction::Query() const
GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_NONE);
}
if (!direction_valid(_origin.direction))
if (!DirectionValid(_origin.direction))
{
log_warning("Invalid direction for track placement, direction = %d", _origin.direction);
return GameActions::Result(
@ -662,7 +662,7 @@ GameActions::Result TrackPlaceAction::Execute() const
int32_t tempDirection = (_origin.direction + chosenDirection) & 3;
tempLoc.x += CoordsDirectionDelta[tempDirection].x;
tempLoc.y += CoordsDirectionDelta[tempDirection].y;
tempDirection = direction_reverse(tempDirection);
tempDirection = DirectionReverse(tempDirection);
wall_remove_intersecting_walls({ tempLoc, baseZ, clearanceZ }, tempDirection & 3);
}
}

View File

@ -444,7 +444,7 @@ bool WallPlaceAction::WallCheckObstructionWithTrack(
{
if (!(ted.Coordinates.rotation_begin & 4))
{
direction = direction_reverse(trackElement->GetDirection());
direction = DirectionReverse(trackElement->GetDirection());
if (direction == _edge)
{
const rct_preview_track* trackBlock = &ted.Block[sequence];

View File

@ -3351,7 +3351,7 @@ void Guest::UpdateBuying()
auto destination = CoordsXY{ 16, 16 } + NextLoc;
SetDestination(destination);
PeepDirection = direction_reverse(PeepDirection);
PeepDirection = DirectionReverse(PeepDirection);
SetState(PeepState::Walking);
return;
@ -4136,7 +4136,7 @@ void Guest::UpdateRideLeaveVehicle()
CoordsXYZD platformLocation;
platformLocation.z = station.GetBaseZ();
platformLocation.direction = direction_reverse(exitLocation.direction);
platformLocation.direction = DirectionReverse(exitLocation.direction);
if (!ride->GetRideTypeDescriptor().HasFlag(RIDE_TYPE_FLAG_VEHICLE_IS_INTEGRAL))
{
@ -4187,7 +4187,7 @@ void Guest::UpdateRideLeaveVehicle()
specialDirection &= 3;
if (vehicle->TrackSubposition == VehicleTrackSubposition::GoKartsRightLane)
specialDirection = direction_reverse(specialDirection);
specialDirection = DirectionReverse(specialDirection);
}
}
@ -4530,7 +4530,7 @@ void Guest::UpdateRideApproachExitWaypoints()
Var37 |= 3;
auto targetLoc = ride->GetStation(CurrentRideStation).Exit.ToCoordsXYZD().ToTileCentre();
uint8_t exit_direction = direction_reverse(targetLoc.direction);
uint8_t exit_direction = DirectionReverse(targetLoc.direction);
int16_t x_shift = DirectionOffsets[exit_direction].x;
int16_t y_shift = DirectionOffsets[exit_direction].y;
@ -4763,8 +4763,8 @@ void Guest::UpdateRideLeaveSpiralSlide()
auto targetLoc = ride->GetStation(CurrentRideStation).Exit.ToCoordsXYZD().ToTileCentre();
int16_t xShift = DirectionOffsets[direction_reverse(targetLoc.direction)].x;
int16_t yShift = DirectionOffsets[direction_reverse(targetLoc.direction)].y;
int16_t xShift = DirectionOffsets[DirectionReverse(targetLoc.direction)].x;
int16_t yShift = DirectionOffsets[DirectionReverse(targetLoc.direction)].y;
int16_t shiftMultiplier = 20;
@ -4841,7 +4841,7 @@ void Guest::UpdateRideMazePathfinding()
// Var37 is 3, 7, 11 or 15
uint8_t hedges[4]{ 0xFF, 0xFF, 0xFF, 0xFF };
uint8_t openCount = 0;
uint8_t mazeReverseLastEdge = direction_reverse(MazeLastEdge);
uint8_t mazeReverseLastEdge = DirectionReverse(MazeLastEdge);
for (uint8_t i = 0; i < 4; ++i)
{
if (!(mazeEntry & (1 << _MazeCurrentDirectionToOpenHedge[Var37 / 4][i])) && i != mazeReverseLastEdge)
@ -6300,7 +6300,7 @@ static bool peep_find_ride_to_look_at(Peep* peep, uint8_t edge, RideId* rideToVi
}
if (tileElement->GetType() != TileElementType::Wall)
continue;
if (direction_reverse(tileElement->GetDirection()) != edge)
if (DirectionReverse(tileElement->GetDirection()) != edge)
continue;
auto wallEntry = tileElement->AsWall()->GetEntry();
if (wallEntry == nullptr || (wallEntry->flags2 & WALL_SCENERY_2_IS_OPAQUE))
@ -6419,7 +6419,7 @@ static bool peep_find_ride_to_look_at(Peep* peep, uint8_t edge, RideId* rideToVi
}
if (tileElement->GetType() != TileElementType::Wall)
continue;
if (direction_reverse(tileElement->GetDirection()) != edge)
if (DirectionReverse(tileElement->GetDirection()) != edge)
continue;
auto wallEntry = tileElement->AsWall()->GetEntry();
if (wallEntry == nullptr || (wallEntry->flags2 & WALL_SCENERY_2_IS_OPAQUE))
@ -6535,7 +6535,7 @@ static bool peep_find_ride_to_look_at(Peep* peep, uint8_t edge, RideId* rideToVi
}
if (tileElement->GetType() != TileElementType::Wall)
continue;
if (direction_reverse(tileElement->GetDirection()) != edge)
if (DirectionReverse(tileElement->GetDirection()) != edge)
continue;
auto wallEntry = tileElement->AsWall()->GetEntry();
if (wallEntry == nullptr || (wallEntry->flags2 & WALL_SCENERY_2_IS_OPAQUE))

View File

@ -1666,7 +1666,7 @@ void Peep::SwitchNextActionSpriteType()
*/
static void peep_return_to_centre_of_tile(Peep* peep)
{
peep->PeepDirection = direction_reverse(peep->PeepDirection);
peep->PeepDirection = DirectionReverse(peep->PeepDirection);
auto destination = peep->GetLocation().ToTileCentre();
peep->SetDestination(destination, 5);
}
@ -1811,7 +1811,7 @@ static bool peep_interact_with_entrance(Peep* peep, const CoordsXYE& coords, uin
uint8_t entranceDirection = tile_element->GetDirection();
if (entranceDirection != guest->PeepDirection)
{
if (direction_reverse(entranceDirection) != guest->PeepDirection)
if (DirectionReverse(entranceDirection) != guest->PeepDirection)
{
peep_return_to_centre_of_tile(guest);
return true;
@ -1904,7 +1904,7 @@ static bool peep_interact_with_entrance(Peep* peep, const CoordsXYE& coords, uin
break;
}
if (direction_reverse(slopeDirection) != entranceDirection)
if (DirectionReverse(slopeDirection) != entranceDirection)
continue;
if (z - 2 != nextTileElement->base_height)
@ -2180,7 +2180,7 @@ static void peep_interact_with_path(Peep* peep, const CoordsXYE& coords)
if ((tile_element->AsPath()->HasQueueBanner())
&& (tile_element->AsPath()->GetQueueBannerDirection()
== direction_reverse(guest->PeepDirection)) // Ride sign is facing the direction the peep is walking
== DirectionReverse(guest->PeepDirection)) // Ride sign is facing the direction the peep is walking
)
{
/* Peep is approaching the entrance of a ride queue.

View File

@ -531,10 +531,10 @@ bool Staff::DoHandymanPathFinding()
}
else
{
pathDirections &= ~(1 << direction_reverse(PeepDirection));
pathDirections &= ~(1 << DirectionReverse(PeepDirection));
if (pathDirections == 0)
{
pathDirections |= 1 << direction_reverse(PeepDirection);
pathDirections |= 1 << DirectionReverse(PeepDirection);
}
}
@ -550,7 +550,7 @@ bool Staff::DoHandymanPathFinding()
}
// newDirection can only contain a cardinal direction at this point, no diagonals
assert(direction_valid(newDirection));
assert(DirectionValid(newDirection));
CoordsXY chosenTile = CoordsXY{ NextLoc } + CoordsDirectionDelta[newDirection];
@ -594,7 +594,7 @@ Direction Staff::DirectionSurface(Direction initialDirection) const
if (WallInTheWay({ NextLoc, NextLoc.z, NextLoc.z + PEEP_CLEARANCE_HEIGHT }, direction))
continue;
if (WallInTheWay({ NextLoc, NextLoc.z, NextLoc.z + PEEP_CLEARANCE_HEIGHT }, direction_reverse(direction)))
if (WallInTheWay({ NextLoc, NextLoc.z, NextLoc.z + PEEP_CLEARANCE_HEIGHT }, DirectionReverse(direction)))
continue;
CoordsXY chosenTile = CoordsXY{ NextLoc } + CoordsDirectionDelta[direction];
@ -669,10 +669,10 @@ Direction Staff::MechanicDirectionPath(uint8_t validDirections, PathElement* pat
}
// Check if this is dead end - i.e. only way out is the reverse direction.
pathDirections &= ~(1 << direction_reverse(PeepDirection));
pathDirections &= ~(1 << DirectionReverse(PeepDirection));
if (pathDirections == 0)
{
pathDirections |= (1 << direction_reverse(PeepDirection));
pathDirections |= (1 << DirectionReverse(PeepDirection));
}
Direction direction = bitscanforward(pathDirections);
@ -767,7 +767,7 @@ bool Staff::DoMechanicPathFinding()
}
// countof(CoordsDirectionDelta)
assert(direction_valid(newDirection));
assert(DirectionValid(newDirection));
CoordsXY chosenTile = CoordsXY{ NextLoc } + CoordsDirectionDelta[newDirection];
@ -801,10 +801,10 @@ Direction Staff::DirectionPath(uint8_t validDirections, PathElement* pathElement
return DirectionSurface(scenario_rand() & 3);
}
pathDirections &= ~(1 << direction_reverse(PeepDirection));
pathDirections &= ~(1 << DirectionReverse(PeepDirection));
if (pathDirections == 0)
{
pathDirections |= (1 << direction_reverse(PeepDirection));
pathDirections |= (1 << DirectionReverse(PeepDirection));
}
Direction direction = bitscanforward(pathDirections);
@ -815,7 +815,7 @@ Direction Staff::DirectionPath(uint8_t validDirections, PathElement* pathElement
}
direction = scenario_rand() & 3;
for (uint8_t i = 0; i < NumOrthogonalDirections; ++i, direction = direction_next(direction))
for (uint8_t i = 0; i < NumOrthogonalDirections; ++i, direction = DirectionNext(direction))
{
if (pathDirections & (1 << direction))
return direction;

View File

@ -38,7 +38,7 @@ static void PaintBannerScrollingText(
PROFILED_FUNCTION();
// If text on hidden direction or ghost
direction = direction_reverse(direction) - 1;
direction = DirectionReverse(direction) - 1;
if (direction >= 2 || (bannerElement.IsGhost()))
return;

View File

@ -1156,7 +1156,7 @@ void PaintSurface(paint_session& session, uint8_t direction, uint16_t height, co
{
PaintAddImageAsParent(session, ImageId(SPR_TERRAIN_SELECTION_SQUARE_SIMPLE), { 0, 0, spawn.z }, { 32, 32, 16 });
const int32_t offset = (direction_reverse(spawn.direction) + rotation) & 3;
const int32_t offset = (DirectionReverse(spawn.direction) + rotation) & 3;
const auto image_id = ImageId(PEEP_SPAWN_ARROW_0 + offset, COLOUR_LIGHT_BLUE);
PaintAddImageAsParent(session, image_id, { 0, 0, spawn.z }, { 32, 32, 19 });
}

View File

@ -126,7 +126,7 @@ static int32_t path_get_permitted_edges(PathElement* pathElement)
*/
static int32_t peep_move_one_tile(Direction direction, Peep& peep)
{
assert(direction_valid(direction));
assert(DirectionValid(direction));
auto newTile = CoordsXY{ CoordsXY{ peep.NextLoc } + CoordsDirectionDelta[direction] }.ToTileCentre();
if (newTile.x >= MAXIMUM_MAP_SIZE_BIG || newTile.y >= MAXIMUM_MAP_SIZE_BIG)
@ -189,7 +189,7 @@ static int32_t guest_surface_path_finding(Peep& peep)
{
pathPos.x += CoordsDirectionDelta[randDirection].x;
pathPos.y += CoordsDirectionDelta[randDirection].y;
Direction backwardsDirection = direction_reverse(randDirection);
Direction backwardsDirection = DirectionReverse(randDirection);
if (!WallInTheWay(pathPos, backwardsDirection))
{
@ -214,7 +214,7 @@ static int32_t guest_surface_path_finding(Peep& peep)
{
pathPos.x += CoordsDirectionDelta[randDirection].x;
pathPos.y += CoordsDirectionDelta[randDirection].y;
Direction backwardsDirection = direction_reverse(randDirection);
Direction backwardsDirection = DirectionReverse(randDirection);
if (!WallInTheWay(pathPos, backwardsDirection))
{
@ -234,7 +234,7 @@ static int32_t guest_surface_path_finding(Peep& peep)
{
pathPos.x += CoordsDirectionDelta[randDirection].x;
pathPos.y += CoordsDirectionDelta[randDirection].y;
Direction backwardsDirection = direction_reverse(randDirection);
Direction backwardsDirection = DirectionReverse(randDirection);
if (!WallInTheWay(pathPos, backwardsDirection))
{
@ -388,7 +388,7 @@ static uint8_t footpath_element_dest_in_dir(TileCoordsXYZ loc, Direction chosenD
return PATH_SEARCH_WIDE;
uint8_t edges = path_get_permitted_edges(tileElement->AsPath());
edges &= ~(1 << direction_reverse(chosenDirection));
edges &= ~(1 << DirectionReverse(chosenDirection));
loc.z = tileElement->base_height;
for (Direction dir : ALL_DIRECTIONS)
@ -1005,7 +1005,7 @@ static void peep_pathfind_heuristic_search(
#endif // defined(DEBUG_LEVEL_2) && DEBUG_LEVEL_2
/* Remove the reverse edge (i.e. the edge back to the previous map element.) */
edges &= ~(1 << direction_reverse(test_edge));
edges &= ~(1 << DirectionReverse(test_edge));
int32_t next_test_edge = bitscanforward(edges);
@ -1405,7 +1405,7 @@ Direction OriginalPathfinding::ChooseDirection(const TileCoordsXYZ& loc, Peep& p
/* If this is a new goal for the peep. Store it and reset the peep's
* PathfindHistory. */
if (!direction_valid(peep.PathfindGoal.direction) || peep.PathfindGoal != goal)
if (!DirectionValid(peep.PathfindGoal.direction) || peep.PathfindGoal != goal)
{
peep.PathfindGoal = { goal, 0 };
@ -1599,13 +1599,13 @@ Direction OriginalPathfinding::ChooseDirection(const TileCoordsXYZ& loc, Peep& p
peep.PathfindHistory[i].direction &= ~(1 << chosen_edge);
/* Also remove the edge through which the peep
* entered the junction from those left to try. */
peep.PathfindHistory[i].direction &= ~(1 << direction_reverse(peep.PeepDirection));
peep.PathfindHistory[i].direction &= ~(1 << DirectionReverse(peep.PeepDirection));
#if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1
if (_pathFindDebug)
{
log_verbose(
"Updating existing pf_history (in index: %d) for %d,%d,%d without entry edge %d & exit edge %d.", i,
loc.x, loc.y, loc.z, direction_reverse(peep.PeepDirection), chosen_edge);
loc.x, loc.y, loc.z, DirectionReverse(peep.PeepDirection), chosen_edge);
}
#endif // defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1
return chosen_edge;
@ -1621,13 +1621,13 @@ Direction OriginalPathfinding::ChooseDirection(const TileCoordsXYZ& loc, Peep& p
peep.PathfindHistory[i].direction &= ~(1 << chosen_edge);
/* Also remove the edge through which the peep
* entered the junction from those left to try. */
peep.PathfindHistory[i].direction &= ~(1 << direction_reverse(peep.PeepDirection));
peep.PathfindHistory[i].direction &= ~(1 << DirectionReverse(peep.PeepDirection));
#if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1
if (_pathFindDebug)
{
log_verbose(
"Storing new pf_history (in index: %d) for %d,%d,%d without entry edge %d & exit edge %d.", i, loc.x, loc.y,
loc.z, direction_reverse(peep.PeepDirection), chosen_edge);
loc.z, DirectionReverse(peep.PeepDirection), chosen_edge);
}
#endif // defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1
}
@ -1820,7 +1820,7 @@ static void get_ride_queue_end(TileCoordsXYZ& loc)
if (!found)
return;
Direction direction = direction_reverse(tileElement->GetDirection());
Direction direction = DirectionReverse(tileElement->GetDirection());
TileElement* lastPathElement = nullptr;
TileElement* firstPathElement = nullptr;
@ -1875,7 +1875,7 @@ static void get_ride_queue_end(TileCoordsXYZ& loc)
if (!tileElement->AsPath()->IsSloped())
break;
if (tileElement->AsPath()->GetSlopeDirection() != direction_reverse(direction))
if (tileElement->AsPath()->GetSlopeDirection() != DirectionReverse(direction))
break;
baseZ -= 2;
@ -1890,7 +1890,7 @@ static void get_ride_queue_end(TileCoordsXYZ& loc)
if (!tileElement->AsPath()->IsQueue())
break;
if (!(tileElement->AsPath()->GetEdges() & (1 << direction_reverse(direction))))
if (!(tileElement->AsPath()->GetEdges() & (1 << DirectionReverse(direction))))
break;
if (firstPathElement == nullptr)
@ -1906,7 +1906,7 @@ static void get_ride_queue_end(TileCoordsXYZ& loc)
if (tileElement->AsPath()->GetEdges() & (1 << (direction)))
continue;
direction = direction_reverse(direction);
direction = DirectionReverse(direction);
// More queue to go.
if (tileElement->AsPath()->GetEdges() & (1 << (direction)))
continue;
@ -2024,7 +2024,7 @@ int32_t OriginalPathfinding::CalculateNextDestination(Guest& peep)
edges = adjustedEdges;
}
int32_t direction = direction_reverse(peep.PeepDirection);
int32_t direction = DirectionReverse(peep.PeepDirection);
// Check if in a dead end (i.e. only edge is where the peep came from)
if (!(edges & ~(1 << direction)))
{
@ -2280,7 +2280,7 @@ bool GuestPathfinding::IsValidPathZAndDirection(TileElement* tileElement, int32_
}
else
{
slopeDirection = direction_reverse(slopeDirection);
slopeDirection = DirectionReverse(slopeDirection);
if (slopeDirection != currentDirection)
return false;
if (currentZ != tileElement->base_height + 2)

View File

@ -580,7 +580,7 @@ bool track_block_get_next(CoordsXYE* input, CoordsXYE* output, int32_t* z, int32
CoordsXY trackCoordOffset = { trackCoordinate.x, trackCoordinate.y };
CoordsXY trackBlockOffset = { trackBlock->x, trackBlock->y };
coords += trackCoordOffset.Rotate(rotation);
coords += trackBlockOffset.Rotate(direction_reverse(rotation));
coords += trackBlockOffset.Rotate(DirectionReverse(rotation));
OriginZ -= trackBlock->z;
OriginZ += trackCoordinate.z_end;
@ -603,7 +603,7 @@ bool track_block_get_previous_from_zero(
const CoordsXYZ& startPos, Ride* ride, uint8_t direction, track_begin_end* outTrackBeginEnd)
{
uint8_t directionStart = direction;
direction = direction_reverse(direction);
direction = DirectionReverse(direction);
auto trackPos = startPos;
if (!(direction & TRACK_BLOCK_2))
@ -617,7 +617,7 @@ bool track_block_get_previous_from_zero(
outTrackBeginEnd->end_x = trackPos.x;
outTrackBeginEnd->end_y = trackPos.y;
outTrackBeginEnd->begin_element = nullptr;
outTrackBeginEnd->begin_direction = direction_reverse(directionStart);
outTrackBeginEnd->begin_direction = DirectionReverse(directionStart);
return false;
}
@ -660,7 +660,7 @@ bool track_block_get_previous_from_zero(
CoordsXY coords = { outTrackBeginEnd->begin_x, outTrackBeginEnd->begin_y };
CoordsXY offsets = { nextTrackCoordinate.x, nextTrackCoordinate.y };
coords += offsets.Rotate(direction_reverse(nextRotation));
coords += offsets.Rotate(DirectionReverse(nextRotation));
outTrackBeginEnd->begin_x = coords.x;
outTrackBeginEnd->begin_y = coords.y;
@ -673,7 +673,7 @@ bool track_block_get_previous_from_zero(
outTrackBeginEnd->begin_z += nextTrackBlock2->z - nextTrackBlock->z;
outTrackBeginEnd->begin_direction = nextRotation;
outTrackBeginEnd->end_direction = direction_reverse(directionStart);
outTrackBeginEnd->end_direction = DirectionReverse(directionStart);
return true;
} while (!(tileElement++)->IsLastForTile());
@ -681,7 +681,7 @@ bool track_block_get_previous_from_zero(
outTrackBeginEnd->end_y = trackPos.y;
outTrackBeginEnd->begin_z = trackPos.z;
outTrackBeginEnd->begin_element = nullptr;
outTrackBeginEnd->end_direction = direction_reverse(directionStart);
outTrackBeginEnd->end_direction = DirectionReverse(directionStart);
return false;
}
@ -722,7 +722,7 @@ bool track_block_get_previous(const CoordsXYE& trackPos, track_begin_end* outTra
uint8_t rotation = trackElement->GetDirection();
CoordsXY coords = CoordsXY{ trackPos };
CoordsXY offsets = { trackBlock->x, trackBlock->y };
coords += offsets.Rotate(direction_reverse(rotation));
coords += offsets.Rotate(DirectionReverse(rotation));
z -= trackBlock->z;
z += trackCoordinate.z_begin;
@ -2349,7 +2349,7 @@ static void ride_shop_connected(Ride* ride)
entrance_directions >>= 1;
// Flip direction north<->south, east<->west
uint8_t face_direction = direction_reverse(count);
uint8_t face_direction = DirectionReverse(count);
int32_t y2 = shopLoc.y - TileDirectionDelta[face_direction].y;
int32_t x2 = shopLoc.x - TileDirectionDelta[face_direction].x;
@ -2664,7 +2664,7 @@ void Ride::ChainQueues() const
continue;
int32_t direction = tileElement->GetDirection();
FootpathChainRideQueue(id, GetStationIndex(&station), mapLocation, tileElement, direction_reverse(direction));
FootpathChainRideQueue(id, GetStationIndex(&station), mapLocation, tileElement, DirectionReverse(direction));
} while (!(tileElement++)->IsLastForTile());
}
}
@ -5495,7 +5495,7 @@ bool ride_has_adjacent_station(Ride* ride)
if (found)
break;
/* Check the other side of the station */
direction = direction_reverse(direction);
direction = DirectionReverse(direction);
found = check_for_adjacent_station(stationStart, direction);
if (found)
break;

View File

@ -259,14 +259,14 @@ void Ride::RemovePeeps()
auto location = GetStation(stationIndex).Exit.ToCoordsXYZD();
if (!location.IsNull())
{
auto direction = direction_reverse(location.direction);
auto direction = DirectionReverse(location.direction);
exitPosition = location;
exitPosition.x += (DirectionOffsets[direction].x * 20) + COORDS_XY_HALF_TILE;
exitPosition.y += (DirectionOffsets[direction].y * 20) + COORDS_XY_HALF_TILE;
exitPosition.z += 2;
// Reverse direction
exitPosition.direction = direction_reverse(exitPosition.direction);
exitPosition.direction = DirectionReverse(exitPosition.direction);
exitPosition.direction *= 8;
}
@ -401,7 +401,7 @@ std::optional<CoordsXYZ> GetTrackElementOriginAndApplyChanges(
CoordsXY offsets = { trackBlock[sequence].x, trackBlock[sequence].y };
CoordsXY newCoords = location;
newCoords += offsets.Rotate(direction_reverse(mapDirection));
newCoords += offsets.Rotate(DirectionReverse(mapDirection));
auto retCoordsXYZ = CoordsXYZ{ newCoords.x, newCoords.y, location.z - trackBlock[sequence].z };
@ -689,7 +689,7 @@ void ride_construction_set_default_next_piece()
&& ((slope != TRACK_SLOPE_DOWN_25 && slope != TRACK_SLOPE_DOWN_60) || gCheatsEnableChainLiftOnAllTrack);
break;
case RideConstructionState::Back:
direction = direction_reverse(_currentTrackPieceDirection);
direction = DirectionReverse(_currentTrackPieceDirection);
if (!track_block_get_next_from_zero(_currentTrackBegin, ride, direction, &xyElement, &z, &direction, false))
{
ride_construction_reset_current_piece();
@ -1306,7 +1306,7 @@ CoordsXYZD ride_get_entrance_or_exit_position_from_screen_position(const ScreenC
if (trackElement->GetTrackType() == TrackElemType::Maze)
{
// if it's a maze, it can place the entrance and exit immediately
entranceExitCoords.direction = direction_reverse(entranceExitCoords.direction);
entranceExitCoords.direction = DirectionReverse(entranceExitCoords.direction);
gRideEntranceExitPlaceDirection = entranceExitCoords.direction;
return entranceExitCoords;
}
@ -1316,13 +1316,13 @@ CoordsXYZD ride_get_entrance_or_exit_position_from_screen_position(const ScreenC
gRideEntranceExitPlaceStationIndex = trackElement->GetStationIndex();
// get the ride entrance's side relative to the TrackElement
Direction direction = (direction_reverse(entranceExitCoords.direction) - tileElement->GetDirection()) & 3;
Direction direction = (DirectionReverse(entranceExitCoords.direction) - tileElement->GetDirection()) & 3;
const auto& ted = GetTrackElementDescriptor(trackElement->GetTrackType());
if (ted.SequenceProperties[trackElement->GetSequenceIndex()] & (1 << direction))
{
// if that side of the TrackElement supports stations, the ride entrance is valid and faces away from
// the station
entranceExitCoords.direction = direction_reverse(entranceExitCoords.direction);
entranceExitCoords.direction = DirectionReverse(entranceExitCoords.direction);
gRideEntranceExitPlaceDirection = entranceExitCoords.direction;
return entranceExitCoords;
}
@ -1533,7 +1533,7 @@ void Ride::ValidateStations()
uint8_t trackSequence = trackElement->AsTrack()->GetSequenceIndex();
// determine where the ride entrance is relative to the station track
Direction direction = (tileElement->GetDirection() - direction_reverse(trackElement->GetDirection())) & 3;
Direction direction = (tileElement->GetDirection() - DirectionReverse(trackElement->GetDirection())) & 3;
// if the ride entrance is not on a valid side, remove it
ted = &GetTrackElementDescriptor(trackType);
@ -1614,7 +1614,7 @@ bool ride_select_forwards_from_back()
ride_construction_invalidate_current_track();
int32_t z = _currentTrackBegin.z;
int32_t direction = direction_reverse(_currentTrackPieceDirection);
int32_t direction = DirectionReverse(_currentTrackPieceDirection);
CoordsXYE next_track;
if (track_block_get_next_from_zero(_currentTrackBegin, ride, direction, &next_track, &z, &direction, false))
{

View File

@ -671,7 +671,7 @@ std::optional<CoordsXYZD> GetTrackSegmentOrigin(const CoordsXYE& posEl)
// Subtract the current sequence's offset
const auto* trackBlock = &ted.Block[trackEl->GetSequenceIndex()];
CoordsXY trackBlockOffset = { trackBlock->x, trackBlock->y };
coords += trackBlockOffset.Rotate(direction_reverse(direction));
coords += trackBlockOffset.Rotate(DirectionReverse(direction));
coords.z -= trackBlock->z;
return CoordsXYZD(coords, direction);

View File

@ -890,7 +890,7 @@ static void TrackDesignMirrorRide(TrackDesign* td6)
entrance.y = -entrance.y;
if (entrance.direction & 1)
{
entrance.direction = direction_reverse(entrance.direction);
entrance.direction = DirectionReverse(entrance.direction);
}
}
}
@ -914,7 +914,7 @@ static void TrackDesignMirrorMaze(TrackDesign* td6)
{
if (maze.direction & 1)
{
maze.direction = direction_reverse(maze.direction);
maze.direction = DirectionReverse(maze.direction);
}
continue;
}

View File

@ -2753,7 +2753,7 @@ static bool ride_station_can_depart_synchronised(const Ride& ride, StationIndex
// Other search direction.
location = station.GetStart();
direction = direction_reverse(direction) & 3;
direction = DirectionReverse(direction) & 3;
spaceBetween = maxCheckDistance;
while (_lastSynchronisedVehicle < &_synchronisedVehicles[SYNCHRONISED_VEHICLE_COUNT - 1])
{
@ -6976,7 +6976,7 @@ void Vehicle::UpdateSceneryDoorBackwards() const
const rct_track_coordinates* trackCoordinates = &ted.Coordinates;
auto wallCoords = CoordsXYZ{ TrackLocation, TrackLocation.z - trackBlock->z + trackCoordinates->z_begin };
int32_t direction = (GetTrackDirection() + trackCoordinates->rotation_begin) & 3;
direction = direction_reverse(direction);
direction = DirectionReverse(direction);
AnimateSceneryDoor<true>({ wallCoords, static_cast<Direction>(direction) }, TrackLocation, next_vehicle_on_train.IsNull());
}

View File

@ -330,7 +330,7 @@ bool window_ride_construction_update_state(
CoordsXY offsets = { trackCoordinates.x, trackCoordinates.y };
CoordsXY coords = { x, y };
coords += offsets.Rotate(direction_reverse(trackDirection));
coords += offsets.Rotate(DirectionReverse(trackDirection));
x = static_cast<uint16_t>(coords.x);
y = static_cast<uint16_t>(coords.y);
}

View File

@ -514,26 +514,23 @@ static void FootpathConnectCorners(const CoordsXY& footpathPos, PathElement* ini
int32_t direction = initialDirection;
auto currentPos = footpathPos + CoordsDirectionDelta[direction];
std::get<1>(tileElements) = {
FootpathConnectCornersGetNeighbour({ currentPos, z }, (1 << direction_reverse(direction))), currentPos
};
std::get<1>(tileElements) = { FootpathConnectCornersGetNeighbour({ currentPos, z }, (1 << DirectionReverse(direction))),
currentPos };
if (std::get<1>(tileElements).first == nullptr)
continue;
direction = direction_next(direction);
direction = DirectionNext(direction);
currentPos += CoordsDirectionDelta[direction];
std::get<2>(tileElements) = {
FootpathConnectCornersGetNeighbour({ currentPos, z }, (1 << direction_reverse(direction))), currentPos
};
std::get<2>(tileElements) = { FootpathConnectCornersGetNeighbour({ currentPos, z }, (1 << DirectionReverse(direction))),
currentPos };
if (std::get<2>(tileElements).first == nullptr)
continue;
direction = direction_next(direction);
direction = DirectionNext(direction);
currentPos += CoordsDirectionDelta[direction];
// First check link to previous tile
std::get<3>(tileElements) = {
FootpathConnectCornersGetNeighbour({ currentPos, z }, (1 << direction_reverse(direction))), currentPos
};
std::get<3>(tileElements) = { FootpathConnectCornersGetNeighbour({ currentPos, z }, (1 << DirectionReverse(direction))),
currentPos };
if (std::get<3>(tileElements).first == nullptr)
continue;
// Second check link to initial tile
@ -542,18 +539,18 @@ static void FootpathConnectCorners(const CoordsXY& footpathPos, PathElement* ini
if (std::get<3>(tileElements).first == nullptr)
continue;
direction = direction_next(direction);
direction = DirectionNext(direction);
std::get<3>(tileElements).first->SetCorners(std::get<3>(tileElements).first->GetCorners() | (1 << (direction)));
map_invalidate_element(
std::get<3>(tileElements).second, reinterpret_cast<TileElement*>(std::get<3>(tileElements).first));
direction = direction_prev(direction);
direction = DirectionPrev(direction);
std::get<2>(tileElements).first->SetCorners(std::get<2>(tileElements).first->GetCorners() | (1 << (direction)));
map_invalidate_element(
std::get<2>(tileElements).second, reinterpret_cast<TileElement*>(std::get<2>(tileElements).first));
direction = direction_prev(direction);
direction = DirectionPrev(direction);
std::get<1>(tileElements).first->SetCorners(std::get<1>(tileElements).first->GetCorners() | (1 << (direction)));
map_invalidate_element(
@ -667,7 +664,7 @@ static TileElement* FootpathGetElement(const CoordsXYRangedZ& footpathPos, int32
if (!tileElement->AsPath()->IsSloped())
break;
auto slope = direction_reverse(tileElement->AsPath()->GetSlopeDirection());
auto slope = DirectionReverse(tileElement->AsPath()->GetSlopeDirection());
if (slope != direction)
break;
@ -694,7 +691,7 @@ static bool FootpathReconnectQueueToPath(
return false;
if (WallInTheWay(
{ targetQueuePos, tileElement->GetBaseZ(), tileElement->GetClearanceZ() }, direction_reverse(direction)))
{ targetQueuePos, tileElement->GetBaseZ(), tileElement->GetClearanceZ() }, DirectionReverse(direction)))
return false;
}
@ -707,14 +704,14 @@ static bool FootpathReconnectQueueToPath(
if (action > 0)
{
tileElement->AsPath()->SetEdges(tileElement->AsPath()->GetEdges() & ~(1 << direction));
targetQueueElement->SetEdges(targetQueueElement->GetEdges() & ~(1 << (direction_reverse(direction) & 3)));
targetQueueElement->SetEdges(targetQueueElement->GetEdges() & ~(1 << (DirectionReverse(direction) & 3)));
if (action >= 2)
tileElement->AsPath()->SetSlopeDirection(direction);
}
else if (action < 0)
{
tileElement->AsPath()->SetEdges(tileElement->AsPath()->GetEdges() | (1 << direction));
targetQueueElement->SetEdges(targetQueueElement->GetEdges() | (1 << (direction_reverse(direction) & 3)));
targetQueueElement->SetEdges(targetQueueElement->GetEdges() | (1 << (DirectionReverse(direction) & 3)));
}
if (action != 0)
map_invalidate_tile_full(targetQueuePos);
@ -776,7 +773,7 @@ static void loc_6A6F1F(
{
if (query)
{
if (WallInTheWay({ targetPos, tileElement->GetBaseZ(), tileElement->GetClearanceZ() }, direction_reverse(direction)))
if (WallInTheWay({ targetPos, tileElement->GetBaseZ(), tileElement->GetClearanceZ() }, DirectionReverse(direction)))
{
return;
}
@ -809,7 +806,7 @@ static void loc_6A6F1F(
else
{
FootpathDisconnectQueueFromPath(targetPos, tileElement, 1 + ((flags >> 6) & 1));
tileElement->AsPath()->SetEdges(tileElement->AsPath()->GetEdges() | (1 << direction_reverse(direction)));
tileElement->AsPath()->SetEdges(tileElement->AsPath()->GetEdges() | (1 << DirectionReverse(direction)));
if (tileElement->AsPath()->IsQueue())
{
FootpathQueueChainPush(tileElement->AsPath()->GetRideIndex());
@ -859,7 +856,7 @@ static void loc_6A6D7E(
if (tileElement->GetBaseZ() == initialTileElementPos.z - LAND_HEIGHT_STEP)
{
if (tileElement->AsPath()->IsSloped()
&& tileElement->AsPath()->GetSlopeDirection() == direction_reverse(direction))
&& tileElement->AsPath()->GetSlopeDirection() == DirectionReverse(direction))
{
loc_6A6F1F(
initialTileElementPos, direction, tileElement, initialTileElement, targetPos, flags, query,
@ -889,8 +886,7 @@ static void loc_6A6D7E(
{
return;
}
uint16_t dx = direction_reverse(
(direction - tileElement->GetDirection()) & TILE_ELEMENT_DIRECTION_MASK);
uint16_t dx = DirectionReverse((direction - tileElement->GetDirection()) & TILE_ELEMENT_DIRECTION_MASK);
if (!(ted.SequenceProperties[trackSequence] & (1 << dx)))
{
@ -909,7 +905,7 @@ static void loc_6A6D7E(
if (initialTileElementPos.z == tileElement->GetBaseZ())
{
if (entrance_has_direction(
*(tileElement->AsEntrance()), direction_reverse(direction - tileElement->GetDirection())))
*(tileElement->AsEntrance()), DirectionReverse(direction - tileElement->GetDirection())))
{
if (query)
{
@ -1122,7 +1118,7 @@ void FootpathChainRideQueue(
if (!tileElement->AsPath()->IsSloped())
break;
if (direction_reverse(tileElement->AsPath()->GetSlopeDirection()) != direction)
if (DirectionReverse(tileElement->AsPath()->GetSlopeDirection()) != direction)
break;
baseZ -= LAND_HEIGHT_STEP;
@ -1142,7 +1138,7 @@ void FootpathChainRideQueue(
int32_t numEdges = bitcount(edges);
if (numEdges >= 2)
{
int32_t requiredEdgeMask = 1 << direction_reverse(direction);
int32_t requiredEdgeMask = 1 << DirectionReverse(direction);
if (!(edges & requiredEdgeMask))
{
break;
@ -1150,7 +1146,7 @@ void FootpathChainRideQueue(
}
tileElement->AsPath()->SetHasQueueBanner(false);
tileElement->AsPath()->SetEdges(tileElement->AsPath()->GetEdges() | (1 << direction_reverse(direction)));
tileElement->AsPath()->SetEdges(tileElement->AsPath()->GetEdges() | (1 << DirectionReverse(direction)));
tileElement->AsPath()->SetRideIndex(rideIndex);
tileElement->AsPath()->SetStationIndex(entranceIndex);
@ -1169,7 +1165,7 @@ void FootpathChainRideQueue(
if (tileElement->AsPath()->GetEdges() & (1 << direction))
continue;
direction = direction_reverse(direction);
direction = DirectionReverse(direction);
if (tileElement->AsPath()->GetEdges() & (1 << direction))
continue;
}
@ -1183,7 +1179,7 @@ void FootpathChainRideQueue(
lastPathElement->AsPath()->SetHasQueueBanner(true);
lastPathElement->AsPath()->SetQueueBannerDirection(lastPathDirection); // set the ride sign direction
map_animation_create(MAP_ANIMATION_TYPE_QUEUE_BANNER, { lastPath, lastPathElement->GetBaseZ() });
MapAnimationCreate(MAP_ANIMATION_TYPE_QUEUE_BANNER, { lastPath, lastPathElement->GetBaseZ() });
}
}
}
@ -1239,7 +1235,7 @@ void FootpathUpdateQueueChains()
if (tileElement->AsEntrance()->GetRideIndex() != rideIndex)
continue;
Direction direction = direction_reverse(tileElement->GetDirection());
Direction direction = DirectionReverse(tileElement->GetDirection());
FootpathChainRideQueue(
rideIndex, ride->GetStationIndex(&station), station.Entrance.ToCoordsXY(), tileElement, direction);
} while (!(tileElement++)->IsLastForTile());
@ -1369,7 +1365,7 @@ static int32_t FootpathIsConnectedToMapEdgeHelper(CoordsXYZ footpathPos, int32_t
if (ste_tileElement->AsPath()->IsSloped()
&& (ste_slopeDirection = ste_tileElement->AsPath()->GetSlopeDirection()) != ste_direction)
{
if (direction_reverse(ste_slopeDirection) != ste_direction)
if (DirectionReverse(ste_slopeDirection) != ste_direction)
return true;
if (ste_tileElement->GetBaseZ() + PATH_HEIGHT_STEP != ste_targetPos.z)
return true;
@ -1421,7 +1417,7 @@ static int32_t FootpathIsConnectedToMapEdgeHelper(CoordsXYZ footpathPos, int32_t
FootpathFixOwnership(targetPos);
edges = tileElement->AsPath()->GetEdges();
currentTile.direction = direction_reverse(currentTile.direction);
currentTile.direction = DirectionReverse(currentTile.direction);
if (!tileElement->IsLastForTile() && !(flags & FOOTPATH_CONNECTED_MAP_EDGE_IGNORE_NO_ENTRY))
{
int elementIndex = 1;
@ -2056,7 +2052,7 @@ void FootpathUpdateQueueEntranceBanner(const CoordsXY& footpathPos, TileElement*
FootpathQueueChainPush(tileElement->AsEntrance()->GetRideIndex());
FootpathChainRideQueue(
RideId::GetNull(), StationIndex::FromUnderlying(0), footpathPos, tileElement,
direction_reverse(tileElement->GetDirection()));
DirectionReverse(tileElement->GetDirection()));
}
}
}
@ -2073,7 +2069,7 @@ static void FootpathRemoveEdgesTowardsHere(
FootpathQueueChainPush(tileElement->AsPath()->GetRideIndex());
}
auto d = direction_reverse(direction);
auto d = DirectionReverse(direction);
tileElement->AsPath()->SetEdges(tileElement->AsPath()->GetEdges() & ~(1 << d));
int32_t cd = ((d - 1) & 3);
tileElement->AsPath()->SetCorners(tileElement->AsPath()->GetCorners() & ~(1 << cd));
@ -2143,7 +2139,7 @@ static void FootpathRemoveEdgesTowards(const CoordsXYRangedZ& footPathPos, int32
if (!tileElement->AsPath()->IsSloped())
break;
uint8_t slope = direction_reverse(tileElement->AsPath()->GetSlopeDirection());
uint8_t slope = DirectionReverse(tileElement->AsPath()->GetSlopeDirection());
if (slope != direction)
break;
@ -2174,7 +2170,7 @@ bool TileElementWantsPathConnectionTowards(const TileCoordsXYZD& coords, const T
if (!tileElement->AsPath()->IsSloped())
// The footpath is flat, it can be connected to from any direction
return true;
if (tileElement->AsPath()->GetSlopeDirection() == direction_reverse(coords.direction))
if (tileElement->AsPath()->GetSlopeDirection() == DirectionReverse(coords.direction))
// The footpath is sloped and its lowest point matches the edge connection
return true;
}

View File

@ -88,7 +88,7 @@ ObjectEntryIndex LargeSceneryElement::GetEntryIndex() const
LargeSceneryEntry* LargeSceneryElement::GetEntry() const
{
return get_large_scenery_entry(GetEntryIndex());
return GetLargeSceneryEntry(GetEntryIndex());
}
const LargeSceneryObject* LargeSceneryElement::GetObject() const
@ -111,7 +111,7 @@ void LargeSceneryElement::SetSequenceIndex(uint8_t sequence)
SequenceIndex = sequence;
}
LargeSceneryEntry* get_large_scenery_entry(ObjectEntryIndex entryIndex)
LargeSceneryEntry* GetLargeSceneryEntry(ObjectEntryIndex entryIndex)
{
LargeSceneryEntry* result = nullptr;
auto& objMgr = OpenRCT2::GetContext()->GetObjectManager();

View File

@ -13,7 +13,7 @@
#include "Map.h"
#include "TileElement.h"
LargeSceneryEntry* get_large_scenery_entry(ObjectEntryIndex entryIndex);
LargeSceneryEntry* GetLargeSceneryEntry(ObjectEntryIndex entryIndex);
enum
{

View File

@ -545,12 +545,12 @@ constexpr Direction ALL_DIRECTIONS[] = {
* Given a direction, return the direction that points the other way,
* on the same axis.
*/
inline constexpr Direction direction_reverse(Direction dir)
inline constexpr Direction DirectionReverse(Direction dir)
{
return dir ^ 2;
}
inline constexpr bool direction_valid(Direction dir)
inline constexpr bool DirectionValid(Direction dir)
{
return dir < NumOrthogonalDirections;
}
@ -559,7 +559,7 @@ inline constexpr bool direction_valid(Direction dir)
* Given a direction, return the next cardinal direction, wrapping around if necessary.
* (TODO: Figure out if this is CW or CCW)
*/
inline constexpr Direction direction_next(Direction dir)
inline constexpr Direction DirectionNext(Direction dir)
{
return (dir + 1) & 0x03;
}
@ -568,7 +568,7 @@ inline constexpr Direction direction_next(Direction dir)
* Given a direction, return the previous cardinal direction, wrapping around if necessary.
* (TODO: Figure out if this is CW or CCW)
*/
inline constexpr Direction direction_prev(Direction dir)
inline constexpr Direction DirectionPrev(Direction dir)
{
return (dir - 1) & 0x03;
}

View File

@ -696,7 +696,7 @@ bool map_coord_is_connected(const TileCoordsXYZ& loc, uint8_t faceDirection)
if (loc.z == tileElement->base_height + 2)
return true;
}
else if (direction_reverse(slopeDirection) == faceDirection && loc.z == tileElement->base_height)
else if (DirectionReverse(slopeDirection) == faceDirection && loc.z == tileElement->base_height)
{
return true;
}

View File

@ -707,7 +707,7 @@ Guest* Park::GenerateGuest()
const auto spawn = get_random_peep_spawn();
if (spawn != nullptr)
{
auto direction = direction_reverse(spawn->direction);
auto direction = DirectionReverse(spawn->direction);
peep = Guest::Generate({ spawn->x, spawn->y, spawn->z });
if (peep != nullptr)
{

View File

@ -405,7 +405,7 @@ static SceneryEntryBase* GetSceneryEntry(const ScenerySelection& item)
case SCENERY_TYPE_WALL:
return get_wall_entry(item.EntryIndex);
case SCENERY_TYPE_LARGE:
return get_large_scenery_entry(item.EntryIndex);
return GetLargeSceneryEntry(item.EntryIndex);
case SCENERY_TYPE_BANNER:
return get_banner_entry(item.EntryIndex);
default:

View File

@ -787,7 +787,7 @@ namespace OpenRCT2::TileInspector
uint8_t originDirection = trackElement->GetDirection();
CoordsXY offsets = { trackBlock->x, trackBlock->y };
CoordsXY coords = { originX, originY };
coords += offsets.Rotate(direction_reverse(originDirection));
coords += offsets.Rotate(DirectionReverse(originDirection));
originX = static_cast<int16_t>(coords.x);
originY = static_cast<int16_t>(coords.y);
@ -870,7 +870,7 @@ namespace OpenRCT2::TileInspector
uint8_t originDirection = trackElement->GetDirection();
CoordsXY offsets = { trackBlock->x, trackBlock->y };
CoordsXY coords = { originX, originY };
coords += offsets.Rotate(direction_reverse(originDirection));
coords += offsets.Rotate(DirectionReverse(originDirection));
originX = static_cast<int16_t>(coords.x);
originY = static_cast<int16_t>(coords.y);