Use constant for invalid direction

This commit is contained in:
Gymnasiast 2020-03-05 18:27:36 +01:00
parent 33d2155529
commit dcf4301559
No known key found for this signature in database
GPG Key ID: DBFFF47AB2CA3EDD
8 changed files with 21 additions and 21 deletions

View File

@ -951,7 +951,7 @@ static void window_footpath_start_bridge_at_point(const ScreenCoordsXY& screenCo
_window_footpath_provisional_path_arrow_timer = 0;
gFootpathConstructSlope = 0;
gFootpathConstructionMode = PATH_CONSTRUCTION_MODE_BRIDGE_OR_TUNNEL;
gFootpathConstructValidDirections = 255;
gFootpathConstructValidDirections = INVALID_DIRECTION;
window_footpath_set_enabled_and_pressed_widgets();
}
@ -977,7 +977,7 @@ static void window_footpath_construct()
if (gFootpathConstructSlope == 0)
{
gFootpathConstructValidDirections = 0xFF;
gFootpathConstructValidDirections = INVALID_DIRECTION;
}
else
{
@ -1049,7 +1049,7 @@ static void footpath_remove_tile_element(TileElement* tileElement)
gFootpathConstructFromPosition.y -= CoordsDirectionDelta[edge].y;
gFootpathConstructFromPosition.z = z;
gFootpathConstructDirection = edge;
gFootpathConstructValidDirections = 255;
gFootpathConstructValidDirections = INVALID_DIRECTION;
}
/**
@ -1179,7 +1179,7 @@ static void window_footpath_set_enabled_and_pressed_widgets()
// Enable / disable directional widgets
direction = gFootpathConstructValidDirections;
if (direction != 255)
if (direction != INVALID_DIRECTION)
{
disabledWidgets |= (1 << WIDX_DIRECTION_NW) | (1 << WIDX_DIRECTION_NE) | (1 << WIDX_DIRECTION_SW)
| (1 << WIDX_DIRECTION_SE);

View File

@ -366,7 +366,7 @@ static void window_maze_construction_entrance_tooldown(const ScreenCoordsXY& scr
if (entranceOrExitCoords.isNull())
return;
if (gRideEntranceExitPlaceDirection == 0xFF)
if (gRideEntranceExitPlaceDirection == INVALID_DIRECTION)
return;
ride_id_t rideIndex = gRideEntranceExitPlaceRideIndex;

View File

@ -3673,7 +3673,7 @@ void ride_construction_toolupdate_entrance_exit(const ScreenCoordsXY& screenCoor
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT;
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW;
CoordsXYZD entranceOrExitCoords = ride_get_entrance_or_exit_position_from_screen_position(screenCoords);
if (gRideEntranceExitPlaceDirection == 255)
if (gRideEntranceExitPlaceDirection == INVALID_DIRECTION)
{
ride_construction_invalidate_current_track();
return;
@ -3914,7 +3914,7 @@ static void ride_construction_tooldown_entrance_exit(const ScreenCoordsXY& scree
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW;
CoordsXYZD entranceOrExitCoords = ride_get_entrance_or_exit_position_from_screen_position(screenCoords);
if (gRideEntranceExitPlaceDirection == 255)
if (gRideEntranceExitPlaceDirection == INVALID_DIRECTION)
return;
auto rideEntranceExitPlaceAction = RideEntranceExitPlaceAction(

View File

@ -237,7 +237,7 @@ private:
newPeep->pathfind_goal.x = 0xFF;
newPeep->pathfind_goal.y = 0xFF;
newPeep->pathfind_goal.z = 0xFF;
newPeep->pathfind_goal.direction = 0xFF;
newPeep->pathfind_goal.direction = INVALID_DIRECTION;
uint8_t colour = staff_get_colour(_staffType);
newPeep->tshirt_colour = colour;

View File

@ -1749,7 +1749,7 @@ Peep* Peep::Generate(const CoordsXYZ& coords)
peep->pathfind_goal.x = 0xFF;
peep->pathfind_goal.y = 0xFF;
peep->pathfind_goal.z = 0xFF;
peep->pathfind_goal.direction = 0xFF;
peep->pathfind_goal.direction = INVALID_DIRECTION;
peep->item_standard_flags = 0;
peep->item_extra_flags = 0;
peep->guest_heading_to_ride_id = RIDE_ID_NULL;
@ -3196,7 +3196,7 @@ void peep_reset_pathfind_goal(Peep* peep)
peep->pathfind_goal.x = 0xFF;
peep->pathfind_goal.y = 0xFF;
peep->pathfind_goal.z = 0xFF;
peep->pathfind_goal.direction = 0xFF;
peep->pathfind_goal.direction = INVALID_DIRECTION;
}
/**

View File

@ -616,7 +616,7 @@ static bool staff_path_finding_handyman(Peep* peep)
{
peep->staff_mowing_timeout++;
uint8_t litterDirection = 0xFF;
uint8_t litterDirection = INVALID_DIRECTION;
uint8_t validDirections = staff_get_valid_patrol_directions(peep, peep->NextLoc.x, peep->NextLoc.y);
if ((peep->staff_orders & STAFF_ORDERS_SWEEPING) && ((gCurrentTicks + peep->sprite_index) & 0xFFF) > 110)
@ -625,7 +625,7 @@ static bool staff_path_finding_handyman(Peep* peep)
}
Direction direction = INVALID_DIRECTION;
if (litterDirection == 0xFF && (peep->staff_orders & STAFF_ORDERS_MOWING) && peep->staff_mowing_timeout >= 12)
if (litterDirection == INVALID_DIRECTION && (peep->staff_orders & STAFF_ORDERS_MOWING) && peep->staff_mowing_timeout >= 12)
{
direction = staff_handyman_direction_to_uncut_grass(peep, validDirections);
}
@ -651,7 +651,7 @@ static bool staff_path_finding_handyman(Peep* peep)
else
{
bool chooseRandom = true;
if (litterDirection != 0xFF && pathDirections & (1 << litterDirection))
if (litterDirection != INVALID_DIRECTION && pathDirections & (1 << litterDirection))
{
if ((scenario_rand() & 0xFFFF) >= 0x1999)
{

View File

@ -1529,7 +1529,7 @@ private:
dst->pathfind_goal.x = 0xFF;
dst->pathfind_goal.y = 0xFF;
dst->pathfind_goal.z = 0xFF;
dst->pathfind_goal.direction = 0xFF;
dst->pathfind_goal.direction = INVALID_DIRECTION;
// Guests' favourite ride was only saved in LL.
// Set it to N/A if the save comes from the original or AA.

View File

@ -119,7 +119,7 @@ uint8_t gRideEntranceExitPlaceType;
ride_id_t gRideEntranceExitPlaceRideIndex;
uint8_t gRideEntranceExitPlaceStationIndex;
uint8_t gRideEntranceExitPlacePreviousRideConstructionState;
uint8_t gRideEntranceExitPlaceDirection;
Direction gRideEntranceExitPlaceDirection;
uint8_t gLastEntranceStyle;
@ -1091,7 +1091,7 @@ void ride_remove_peeps(Ride* ride)
int32_t exitX = 0;
int32_t exitY = 0;
int32_t exitZ = 0;
int32_t exitDirection = 255;
int32_t exitDirection = INVALID_DIRECTION;
if (stationIndex != -1)
{
TileCoordsXYZD location = ride_get_exit_location(ride, stationIndex);
@ -1130,7 +1130,7 @@ void ride_remove_peeps(Ride* ride)
peep->Invalidate();
if (exitDirection == 255)
if (exitDirection == INVALID_DIRECTION)
{
CoordsXYZ newLoc = { peep->NextLoc.ToTileCentre(), peep->NextLoc.z };
if (peep->GetNextIsSloped())
@ -6145,7 +6145,7 @@ CoordsXYZD ride_get_entrance_or_exit_position_from_screen_position(const ScreenC
Ride* ride;
CoordsXYZD entranceExitCoords{};
gRideEntranceExitPlaceDirection = 255;
gRideEntranceExitPlaceDirection = INVALID_DIRECTION;
CoordsXY unusedCoords;
get_map_coordinates_from_pos(screenCoords, 0xFFFB, unusedCoords, &interactionType, &tileElement, &viewport);
if (interactionType != 0)
@ -6256,7 +6256,7 @@ CoordsXYZD ride_get_entrance_or_exit_position_from_screen_position(const ScreenC
}
entranceExitCoords.direction = (entranceExitCoords.direction + 1) & 3;
}
gRideEntranceExitPlaceDirection = 0xFF;
gRideEntranceExitPlaceDirection = INVALID_DIRECTION;
}
else
{
@ -6879,14 +6879,14 @@ void sub_6CB945(Ride* ride)
CoordsXYZ location = { ride->stations[stationId].Start.x * 32, ride->stations[stationId].Start.y * 32,
ride->stations[stationId].GetBaseZ() };
auto tileHeight = TileCoordsXYZ(location).z;
uint8_t direction = 0xFF;
uint8_t direction = INVALID_DIRECTION;
bool specialTrack = false;
TileElement* tileElement = nullptr;
while (true)
{
if (direction != 0xFF)
if (direction != INVALID_DIRECTION)
{
location.x -= CoordsDirectionDelta[direction].x;
location.y -= CoordsDirectionDelta[direction].y;