mirror of https://github.com/OpenRCT2/OpenRCT2.git
Add a constant for RIDE_ENTRY_INDEX_NULL
This commit is contained in:
parent
26cd0da5be
commit
631f4d8907
|
@ -699,7 +699,7 @@ void lightfx_add_lights_magic_vehicles()
|
|||
|
||||
rct_vehicle *mother_vehicle = vehicle;
|
||||
|
||||
if (mother_vehicle->ride_subtype == 0xFF) {
|
||||
if (mother_vehicle->ride_subtype == RIDE_ENTRY_INDEX_NULL) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -1799,7 +1799,7 @@ private:
|
|||
{
|
||||
// No vehicles found so just add the default for this ride
|
||||
uint8 rideEntryIndex = _rideTypeToRideEntryMap[rct1RideType];
|
||||
Guard::Assert(rideEntryIndex != 255, "rideEntryIndex was 255");
|
||||
Guard::Assert(rideEntryIndex != RIDE_ENTRY_INDEX_NULL, "rideEntryIndex was RIDE_ENTRY_INDEX_NULL");
|
||||
if (!_researchRideEntryUsed[rideEntryIndex])
|
||||
{
|
||||
_researchRideEntryUsed[rideEntryIndex] = true;
|
||||
|
|
|
@ -179,7 +179,7 @@ public:
|
|||
|
||||
uint8 *rideEntryIndexPtr = get_ride_entry_indices_for_ride_type(rideGroup->track_type);
|
||||
|
||||
while (*rideEntryIndexPtr != 255)
|
||||
while (*rideEntryIndexPtr != RIDE_ENTRY_INDEX_NULL)
|
||||
{
|
||||
uint8 rideEntryIndex = *rideEntryIndexPtr++;
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ rct_vehicle *cable_lift_segment_create(sint32 rideIndex, sint32 x, sint32 y, sin
|
|||
rct_vehicle *current = &(create_sprite(1)->vehicle);
|
||||
current->sprite_identifier = SPRITE_IDENTIFIER_VEHICLE;
|
||||
current->ride = rideIndex;
|
||||
current->ride_subtype = 0xFF;
|
||||
current->ride_subtype = RIDE_ENTRY_INDEX_NULL;
|
||||
if (head) {
|
||||
move_sprite_to_list((rct_sprite*)current, SPRITE_LIST_TRAIN * 2);
|
||||
ride->cable_lift = current->sprite_index;
|
||||
|
|
|
@ -4778,7 +4778,7 @@ static void ride_create_vehicles_find_first_block(rct_ride *ride, rct_xy_element
|
|||
static bool ride_create_vehicles(rct_ride *ride, sint32 rideIndex, rct_xy_element *element, sint32 isApplying)
|
||||
{
|
||||
ride_update_max_vehicles(rideIndex);
|
||||
if (ride->subtype == 0xFF) {
|
||||
if (ride->subtype == RIDE_ENTRY_INDEX_NULL) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -5944,9 +5944,9 @@ static money32 ride_create(sint32 type, sint32 subType, sint32 flags, sint32 *ou
|
|||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
if (subType == 255) {
|
||||
if (subType == RIDE_ENTRY_INDEX_NULL) {
|
||||
uint8 *availableRideEntries = get_ride_entry_indices_for_ride_type(type);
|
||||
for (uint8 *rei = availableRideEntries; *rei != 255; rei++) {
|
||||
for (uint8 *rei = availableRideEntries; *rei != RIDE_ENTRY_INDEX_NULL; rei++) {
|
||||
rideEntry = get_ride_entry(*rei);
|
||||
|
||||
// Can happen in select-by-track-type mode
|
||||
|
@ -5961,7 +5961,7 @@ static money32 ride_create(sint32 type, sint32 subType, sint32 flags, sint32 *ou
|
|||
}
|
||||
}
|
||||
subType = availableRideEntries[0];
|
||||
if (subType == 255) {
|
||||
if (subType == RIDE_ENTRY_INDEX_NULL) {
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
}
|
||||
|
@ -6007,7 +6007,7 @@ foundRideEntry:
|
|||
ride->overall_view = 0xFFFF;
|
||||
|
||||
// Ride name
|
||||
if (rideEntryIndex == 255) {
|
||||
if (rideEntryIndex == RIDE_ENTRY_INDEX_NULL) {
|
||||
ride_set_name_to_track_default(ride, rideEntry);
|
||||
} else if (!(rideEntry->flags & RIDE_ENTRY_FLAG_SEPARATE_RIDE_NAME) || rideTypeShouldLoseSeparateFlag(rideEntry)) {
|
||||
ride_set_name_to_track_default(ride, rideEntry);
|
||||
|
@ -7608,7 +7608,7 @@ foundTrack:
|
|||
void ride_update_max_vehicles(sint32 rideIndex)
|
||||
{
|
||||
rct_ride *ride = get_ride(rideIndex);
|
||||
if (ride->subtype == 0xFF)
|
||||
if (ride->subtype == RIDE_ENTRY_INDEX_NULL)
|
||||
return;
|
||||
|
||||
rct_ride_entry *rideEntry = get_ride_entry(ride->subtype);
|
||||
|
@ -7799,7 +7799,7 @@ static bool ride_is_vehicle_type_valid(rct_ride *ride, uint8 inputRideEntryIndex
|
|||
}
|
||||
|
||||
uint8 *rideEntryIndexPtr = get_ride_entry_indices_for_ride_type(rideTypeIterator);
|
||||
for (uint8 *currentRideEntryIndex = rideEntryIndexPtr; *currentRideEntryIndex != 0xFF; currentRideEntryIndex++) {
|
||||
for (uint8 *currentRideEntryIndex = rideEntryIndexPtr; *currentRideEntryIndex != RIDE_ENTRY_INDEX_NULL; currentRideEntryIndex++) {
|
||||
uint8 rideEntryIndex = *currentRideEntryIndex;
|
||||
if (rideEntryIndex == inputRideEntryIndex) {
|
||||
if (!ride_entry_is_invented(rideEntryIndex)) {
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "vehicle.h"
|
||||
|
||||
#define MAX_RIDE_TYPES_PER_RIDE_ENTRY 3
|
||||
#define RIDE_ENTRY_INDEX_NULL 255
|
||||
typedef fixed16_2dp ride_rating;
|
||||
|
||||
// Convenience function for writing ride ratings. The result is a 16 bit signed
|
||||
|
|
|
@ -1329,7 +1329,7 @@ static bool track_design_place_preview(rct_track_td6 *td6, money32 *cost, uint8
|
|||
|
||||
uint8 entry_type, entry_index;
|
||||
if (!find_object_in_entry_group(&td6->vehicle_object, &entry_type, &entry_index)) {
|
||||
entry_index = 0xFF;
|
||||
entry_index = RIDE_ENTRY_INDEX_NULL;
|
||||
}
|
||||
|
||||
uint8 rideIndex;
|
||||
|
@ -1444,7 +1444,7 @@ static money32 place_track_design(sint16 x, sint16 y, sint16 z, uint8 flags, uin
|
|||
rct_ride_entry * ire;
|
||||
|
||||
uint8 *availableRideEntries = get_ride_entry_indices_for_ride_type(td6->type);
|
||||
for (uint8 *rei = availableRideEntries; *rei != 255; rei++)
|
||||
for (uint8 *rei = availableRideEntries; *rei != RIDE_ENTRY_INDEX_NULL; rei++)
|
||||
{
|
||||
ire = get_ride_entry(*rei);
|
||||
|
||||
|
|
|
@ -2348,7 +2348,7 @@ void vehicle_paint(rct_vehicle *vehicle, sint32 imageDirection)
|
|||
return;
|
||||
}
|
||||
|
||||
if (vehicle->ride_subtype == 0xFF) {
|
||||
if (vehicle->ride_subtype == RIDE_ENTRY_INDEX_NULL) {
|
||||
vehicleEntry = &CableLiftVehicle;
|
||||
} else {
|
||||
rideEntry = get_ride_entry(vehicle->ride_subtype);
|
||||
|
|
|
@ -327,7 +327,7 @@ static void window_new_ride_populate_list()
|
|||
}
|
||||
|
||||
nextListItem->type = RIDE_TYPE_NULL;
|
||||
nextListItem->entry_index = 255;
|
||||
nextListItem->entry_index = RIDE_ENTRY_INDEX_NULL;
|
||||
_trackSelectionByType = gConfigInterface.select_by_track_type;
|
||||
}
|
||||
|
||||
|
@ -343,7 +343,7 @@ static ride_list_item * window_new_ride_iterate_over_ride_group(uint8 rideType,
|
|||
safe_strcpy(preferredVehicleName, " ", sizeof(preferredVehicleName));
|
||||
|
||||
// For each ride entry for this ride type
|
||||
while (*rideEntryIndexPtr != 255) {
|
||||
while (*rideEntryIndexPtr != RIDE_ENTRY_INDEX_NULL) {
|
||||
uint8 rideEntryIndex = *rideEntryIndexPtr++;
|
||||
char rideEntryName[9];
|
||||
memcpy(rideEntryName,object_entry_groups[OBJECT_TYPE_RIDE].entries[rideEntryIndex].name,8);
|
||||
|
@ -478,7 +478,7 @@ rct_window *window_new_ride_open()
|
|||
w->frame_no = 0;
|
||||
w->new_ride.selected_ride_id = -1;
|
||||
_lastTrackDesignCountRideType.type = RIDE_TYPE_NULL;
|
||||
_lastTrackDesignCountRideType.entry_index = 255;
|
||||
_lastTrackDesignCountRideType.entry_index = RIDE_ENTRY_INDEX_NULL;
|
||||
w->new_ride.highlighted_ride_id = _windowNewRideHighlightedItem[_windowNewRideCurrentTab].ride_type_and_entry;
|
||||
if (w->new_ride.highlighted_ride_id == -1)
|
||||
w->new_ride.highlighted_ride_id = _windowNewRideListItems[0].ride_type_and_entry;
|
||||
|
@ -881,7 +881,7 @@ static ride_list_item window_new_ride_scroll_get_ride_list_item_at(rct_window *w
|
|||
{
|
||||
ride_list_item result;
|
||||
result.type = RIDE_TYPE_NULL;
|
||||
result.entry_index = 255;
|
||||
result.entry_index = RIDE_ENTRY_INDEX_NULL;
|
||||
|
||||
if (--x < 0 || --y < 0)
|
||||
return result;
|
||||
|
|
|
@ -2664,7 +2664,7 @@ static void window_ride_vehicle_mousedown(rct_widgetindex widgetIndex, rct_windo
|
|||
|
||||
rideEntryIndexPtr = get_ride_entry_indices_for_ride_type(rideTypeIterator);
|
||||
|
||||
for (uint8 *currentRideEntryIndex = rideEntryIndexPtr; *currentRideEntryIndex != 0xFF && numItems <= 63; currentRideEntryIndex++) {
|
||||
for (uint8 *currentRideEntryIndex = rideEntryIndexPtr; *currentRideEntryIndex != RIDE_ENTRY_INDEX_NULL && numItems <= 63; currentRideEntryIndex++) {
|
||||
rideEntryIndex = *currentRideEntryIndex;
|
||||
currentRideEntry = get_ride_entry(rideEntryIndex);
|
||||
// Skip if vehicle wants to be separate, unless subtype switching is enabled
|
||||
|
|
Loading…
Reference in New Issue