Replace loose usages of 0xFF

This commit is contained in:
Gymnasiast 2020-10-27 22:24:39 +01:00
parent 9e17081ee8
commit a3aef90637
No known key found for this signature in database
GPG Key ID: DBFFF47AB2CA3EDD
6 changed files with 14 additions and 14 deletions

View File

@ -273,7 +273,7 @@ rct_window* window_guest_list_open_with_filter(GuestListFilterType type, int32_t
{
case GuestListFilterType::GuestsOnRide:
{
auto ride = get_ride(index & 0xFF);
auto ride = get_ride(index);
if (ride != nullptr)
{
ft.Add<rct_string_id>(ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_IN_RIDE) ? STR_IN_RIDE : STR_ON_RIDE);
@ -288,7 +288,7 @@ rct_window* window_guest_list_open_with_filter(GuestListFilterType type, int32_t
}
case GuestListFilterType::GuestsInQueue:
{
auto ride = get_ride(index & 0xFF);
auto ride = get_ride(index);
if (ride != nullptr)
{
ft.Add<rct_string_id>(STR_QUEUING_FOR);
@ -303,7 +303,7 @@ rct_window* window_guest_list_open_with_filter(GuestListFilterType type, int32_t
}
case GuestListFilterType::GuestsThinkingAboutRide:
{
auto ride = get_ride(index & 0xFF);
auto ride = get_ride(index);
if (ride != nullptr)
{
ft.Add<rct_string_id>(STR_NONE);

View File

@ -1133,7 +1133,7 @@ static void window_ride_draw_tab_images(rct_drawpixelinfo* dpi, rct_window* w)
static void window_ride_disable_tabs(rct_window* w)
{
uint32_t disabled_tabs = 0;
auto ride = get_ride(w->number & 0xFF);
auto ride = get_ride(w->number);
if (ride == nullptr)
return;
@ -3816,7 +3816,7 @@ static void window_ride_maintenance_mousedown(rct_window* w, rct_widgetindex wid
num_items = 1;
for (j = 0; j < MAX_RIDE_TYPES_PER_RIDE_ENTRY; j++)
{
if (rideEntry->ride_type[j] != 0xFF)
if (rideEntry->ride_type[j] != RIDE_TYPE_NULL)
break;
}
gDropdownItemsFormat[0] = STR_DROPDOWN_MENU_LABEL;

View File

@ -186,12 +186,12 @@ void setup_in_use_selection_flags()
}
} while (tile_element_iterator_next(&iter));
for (uint8_t ride_index = 0; ride_index < 0xFF; ride_index++)
for (ride_id_t ride_index = 0; ride_index < MAX_RIDES; ride_index++)
{
auto ride = get_ride(ride_index);
if (ride != nullptr)
{
uint8_t type = ride->subtype;
ObjectEntryIndex type = ride->subtype;
Editor::SetSelectedObject(OBJECT_TYPE_RIDE, type, OBJECT_SELECTION_FLAG_SELECTED);
}
}

View File

@ -174,7 +174,7 @@ GameActions::Result::Ptr TrackDesignAction::Execute() const
return MakeResult(GameActions::Status::Disallowed, error_reason);
}
if (entryIndex != 0xFF)
if (entryIndex != OBJECT_ENTRY_INDEX_NULL)
{
auto colour = ride_get_unused_preset_vehicle_colour(entryIndex);
auto rideSetVehicleAction = RideSetVehicleAction(ride->id, RideSetVehicleType::RideEntry, entryIndex, colour);

View File

@ -284,7 +284,7 @@ static uint8_t footpath_element_next_in_direction(TileCoordsXYZ loc, PathElement
if (nextTileElement->AsPath()->IsWide())
return PATH_SEARCH_WIDE;
// Only queue tiles that are connected to a ride are returned as ride queues.
if (nextTileElement->AsPath()->IsQueue() && nextTileElement->AsPath()->GetRideIndex() != 0xFF)
if (nextTileElement->AsPath()->IsQueue() && nextTileElement->AsPath()->GetRideIndex() != RIDE_ID_NULL)
return PATH_SEARCH_RIDE_QUEUE;
return PATH_SEARCH_OTHER;

View File

@ -2316,7 +2316,7 @@ static void peep_interact_with_entrance(Peep* peep, const CoordsXYE& coords, uin
{
// Default guest/staff behaviour attempting to enter a
// ride exit is to turn around.
peep->InteractionRideIndex = 0xFF;
peep->InteractionRideIndex = RIDE_ID_NULL;
peep_return_to_centre_of_tile(peep);
return;
}
@ -2333,7 +2333,7 @@ static void peep_interact_with_entrance(Peep* peep, const CoordsXYE& coords, uin
{
// Default staff behaviour attempting to enter a
// ride entrance is to turn around.
peep->InteractionRideIndex = 0xFF;
peep->InteractionRideIndex = RIDE_ID_NULL;
peep_return_to_centre_of_tile(peep);
return;
}
@ -2774,7 +2774,7 @@ static void peep_interact_with_path(Peep* peep, const CoordsXYE& coords)
else
{
// Queue got disconnected from the original ride.
peep->InteractionRideIndex = 0xFF;
peep->InteractionRideIndex = RIDE_ID_NULL;
guest->RemoveFromQueue();
peep->SetState(PeepState::One);
peep_footpath_move_forward(peep, { coords, tile_element }, vandalism_present);
@ -2845,7 +2845,7 @@ static void peep_interact_with_path(Peep* peep, const CoordsXYE& coords)
}
else
{
peep->InteractionRideIndex = 0xFF;
peep->InteractionRideIndex = RIDE_ID_NULL;
if (peep->State == PeepState::Queuing)
{
peep->RemoveFromQueue();
@ -3059,7 +3059,7 @@ void Peep::PerformNextAction(uint8_t& pathing_result, TileElement*& tile_result)
int16_t height = abs(tile_element_height(newLoc) - z);
if (height <= 3 || (AssignedPeepType == PeepType::Staff && height <= 32))
{
InteractionRideIndex = 0xFF;
InteractionRideIndex = RIDE_ID_NULL;
if (State == PeepState::Queuing)
{
RemoveFromQueue();