1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-24 23:34:37 +01:00

refactor ride type flag checks

This commit is contained in:
IntelOrca
2015-03-07 19:15:47 +00:00
parent c4f1fa3b0c
commit 6ae0c10350
10 changed files with 100 additions and 68 deletions

View File

@@ -288,7 +288,7 @@ static int award_is_deserved_best_food(int awardType, int activeAwardTypes)
FOR_ALL_RIDES(i, ride) {
if (ride->status != RIDE_STATUS_OPEN)
continue;
if (!(RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8), uint32) & 0x800000))
if (!ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_23))
continue;
shops++;
@@ -334,7 +334,7 @@ static int award_is_deserved_worst_food(int awardType, int activeAwardTypes)
FOR_ALL_RIDES(i, ride) {
if (ride->status != RIDE_STATUS_OPEN)
continue;
if (!(RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8), uint32) & 0x800000))
if (!ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_23))
continue;
shops++;
@@ -459,7 +459,7 @@ static int award_is_deserved_best_custom_designed_rides(int awardType, int activ
customDesignedRides = 0;
FOR_ALL_RIDES(i, ride) {
if (!(RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8), uint32) & 0x10000000))
if (!ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_28))
continue;
if (ride->lifecycle_flags & RIDE_LIFECYCLE_18)
continue;
@@ -488,7 +488,7 @@ static int award_is_deserved_most_dazzling_ride_colours(int awardType, int activ
countedRides = 0;
colourfulRides = 0;
FOR_ALL_RIDES(i, ride) {
if (!(RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8), uint32) & 0x10000000))
if (!ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_28))
continue;
countedRides++;

View File

@@ -1990,7 +1990,7 @@ void peep_problem_warnings_update()
break;
}
ride = &g_ride_list[peep->guest_heading_to_ride_id];
if (!(RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + ride->type * 8, uint32) & 0x80000))
if (!ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_19))
hunger_counter++;
break;
@@ -2000,7 +2000,7 @@ void peep_problem_warnings_update()
break;
}
ride = &g_ride_list[peep->guest_heading_to_ride_id];
if (!(RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + ride->type * 8, uint32) & 0x1000000))
if (!ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_24))
thirst_counter++;
break;
@@ -2010,7 +2010,7 @@ void peep_problem_warnings_update()
break;
}
ride = &g_ride_list[peep->guest_heading_to_ride_id];
if (!(RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + ride->type * 8, uint32) & 0x2000000))
if (!ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_25))
bathroom_counter++;
break;
@@ -2261,9 +2261,8 @@ void get_arguments_from_action(rct_peep* peep, uint32 *argument_1, uint32* argum
case PEEP_STATE_ENTERING_RIDE:
*argument_1 = STR_ON_RIDE;
ride = g_ride_list[peep->current_ride];
if (RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + ride.type * 8, uint32) & 0x400000){
if (ride_type_has_flag(ride.type, RIDE_TYPE_FLAG_22))
*argument_1 = STR_IN_RIDE;
}
*argument_1 |= (ride.name << 16);
*argument_2 = ride.name_arguments;
break;

View File

@@ -422,7 +422,7 @@ void ride_get_status(int rideIndex, int *formatSecondary, int *argument)
*formatSecondary = STR_RACE_WON_BY;
}
} else {
if (!(RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + ride->type * 8, uint32) & 0x20000)) {
if (!ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_17)) {
*argument = ride->num_riders;
*formatSecondary = STR_PERSON_ON_RIDE;
if(*argument != 1)
@@ -956,7 +956,7 @@ int ride_modify(rct_xy_element *input)
if (ride->type == RIDE_TYPE_MAZE)
return ride_modify_maze(mapElement.element, mapElement.x, mapElement.y);
if (RCT2_ADDRESS(RCT2_ADDRESS_RIDE_FLAGS,uint64)[ride->type] & 0x100) {
if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_8)) {
if (ride_find_track_gap(&mapElement, &endOfTrackElement))
mapElement = endOfTrackElement;
}
@@ -980,7 +980,7 @@ int ride_modify(rct_xy_element *input)
RCT2_GLOBAL(0x00F440B0, uint8) = 0;
RCT2_GLOBAL(0x00F440B1, uint8) = 0;
if (RCT2_ADDRESS(RCT2_ADDRESS_RIDE_FLAGS, uint64)[ride->type] & 0x8000) {
if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_15)) {
sub_6C84CE();
return 1;
}
@@ -2020,7 +2020,7 @@ rct_ride_measurement *ride_get_measurement(int rideIndex, rct_string_id *message
ride = GET_RIDE(rideIndex);
// Check if ride type supports data logging
if (!(RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8), uint32) & 0x200)) {
if (!ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_9)) {
if (message != NULL) *message = STR_DATA_LOGGING_NOT_AVAILABLE_FOR_THIS_TYPE_OF_RIDE;
return NULL;
}
@@ -2053,7 +2053,7 @@ rct_ride_measurement *ride_get_measurement(int rideIndex, rct_string_id *message
measurement->ride_index = rideIndex;
ride->measurement_index = i;
measurement->flags = 0;
if (RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8), uint32) & 0x80)
if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_7))
measurement->flags |= RIDE_MEASUREMENT_FLAG_G_FORCES;
measurement->num_items = 0;
measurement->current_item = 0;
@@ -2111,8 +2111,8 @@ void ride_check_all_reachable()
if (ride->status != RIDE_STATUS_OPEN || ride->connected_message_throttle != 0)
continue;
if (RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + ride->type * 8, uint32) & 0x20000)
ride_shop_connected(ride, i);
if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_17))
ride_shop_connected(ride, i);
else
ride_entrance_exit_connected(ride, i);
}
@@ -2202,7 +2202,7 @@ static void ride_shop_connected(rct_ride* ride, int ride_idx)
uint16 entrance_directions = 0;
uint8 track_type = mapElement->properties.track.type;
ride = &g_ride_list[mapElement->properties.track.ride_index];
if (RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + ride->type * 8, uint32) & 0x80000) {
if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_19)) {
entrance_directions = RCT2_ADDRESS(0x0099CA64, uint8)[track_type * 16];
} else {
entrance_directions = RCT2_ADDRESS(0x0099BA64, uint8)[track_type * 16];
@@ -2808,7 +2808,7 @@ int ride_mode_check_station_present(rct_ride* ride){
if (stationIndex == -1) {
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TEXT, uint16) = STR_NOT_YET_CONSTRUCTED;
if (RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8), uint32) & 0x8000)
if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_15))
return -1;
if (ride->type == RIDE_TYPE_MAZE)
@@ -2829,7 +2829,8 @@ int ride_check_for_entrance_exit(int rideIndex)
{
rct_ride* ride = GET_RIDE(rideIndex);
if (RCT2_ADDRESS(RCT2_ADDRESS_RIDE_FLAGS, uint32)[ride->type * 2] & 0x20000) return 1;
if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_17))
return 1;
int i;
uint8 entrance = 0;
@@ -3294,7 +3295,7 @@ int ride_is_valid_for_open(int rideIndex, int goingToBeOpen, int isApplying)
sub_6B4D26(rideIndex, &trackElement);
if (
!(RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8), uint32) & 0x2000) &&
!ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_13) &&
!(ride->lifecycle_flags & RIDE_LIFECYCLE_ON_TRACK)
) {
if (sub_6DD84C(ride, rideIndex, &trackElement, isApplying))
@@ -3453,4 +3454,9 @@ void game_command_set_ride_name(int *eax, int *ebx, int *ecx, int *edx, int *esi
}
*ebx = 0;
}
bool ride_type_has_flag(int rideType, int flag)
{
return (RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (rideType * 8), uint32) & flag) != 0;
}

View File

@@ -623,6 +623,41 @@ enum {
RIDE_MEASUREMENT_FLAG_G_FORCES = 1 << 2
};
enum {
RIDE_TYPE_FLAG_0 = 1 << 0,
RIDE_TYPE_FLAG_1 = 1 << 1,
RIDE_TYPE_FLAG_2 = 1 << 2,
RIDE_TYPE_FLAG_3 = 1 << 3,
RIDE_TYPE_FLAG_4 = 1 << 4,
RIDE_TYPE_FLAG_5 = 1 << 5,
RIDE_TYPE_FLAG_6 = 1 << 6,
RIDE_TYPE_FLAG_7 = 1 << 7,
RIDE_TYPE_FLAG_8 = 1 << 8,
RIDE_TYPE_FLAG_9 = 1 << 9,
RIDE_TYPE_FLAG_10 = 1 << 10,
RIDE_TYPE_FLAG_11 = 1 << 11,
RIDE_TYPE_FLAG_12 = 1 << 12,
RIDE_TYPE_FLAG_13 = 1 << 13,
RIDE_TYPE_FLAG_14 = 1 << 14,
RIDE_TYPE_FLAG_15 = 1 << 15,
RIDE_TYPE_FLAG_16 = 1 << 16,
RIDE_TYPE_FLAG_17 = 1 << 17,
RIDE_TYPE_FLAG_18 = 1 << 18,
RIDE_TYPE_FLAG_19 = 1 << 19,
RIDE_TYPE_FLAG_20 = 1 << 20,
RIDE_TYPE_FLAG_21 = 1 << 21,
RIDE_TYPE_FLAG_22 = 1 << 22,
RIDE_TYPE_FLAG_23 = 1 << 23,
RIDE_TYPE_FLAG_24 = 1 << 24,
RIDE_TYPE_FLAG_25 = 1 << 25,
RIDE_TYPE_FLAG_26 = 1 << 26,
RIDE_TYPE_FLAG_27 = 1 << 27,
RIDE_TYPE_FLAG_28 = 1 << 28,
RIDE_TYPE_FLAG_29 = 1 << 29,
RIDE_TYPE_FLAG_30 = 1 << 30,
RIDE_TYPE_FLAG_31 = 1 << 31,
};
#define MAX_RIDES 255
#define MAX_RIDE_MEASUREMENTS 8
@@ -692,4 +727,6 @@ void game_command_set_ride_status(int *eax, int *ebx, int *ecx, int *edx, int *e
void ride_set_name(int rideIndex, const char *name);
void game_command_set_ride_name(int *eax, int *ebx, int *ecx, int *edx, int *esi, int *edi, int *ebp);
bool ride_type_has_flag(int rideType, int flag);
#endif

View File

@@ -1289,7 +1289,7 @@ int save_track_design(uint8 rideIndex){
return 0;
}
if (!(RCT2_ADDRESS(RCT2_ADDRESS_RIDE_FLAGS, uint32)[ride->type * 2] & 0x10000000)){
if (!ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_28)) {
window_error_open(3346, RCT2_GLOBAL(0x141E9AC, rct_string_id));
return 0;
}

View File

@@ -173,7 +173,7 @@ void window_new_campaign_open(sint16 campaignType)
numApplicableRides = 0;
window_new_campaign_rides[0] = 255;
FOR_ALL_RIDES(i, ride) {
if (!(RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8), uint32) & 0x03820000))
if (!ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_17 | RIDE_TYPE_FLAG_23 | RIDE_TYPE_FLAG_24 | RIDE_TYPE_FLAG_25))
window_new_campaign_rides[numApplicableRides++] = i;
}

View File

@@ -934,8 +934,7 @@ static void window_new_ride_paint_ride_information(rct_window *w, rct_drawpixeli
gfx_draw_string_left_wrapped(dpi, (void*)0x013CE952, x, y, width, 1690, 0);
// Number of designs available
uint32 rideTypeFlags = RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (item.type * 8), uint32);
if (rideTypeFlags & 0x10000000) {
if (ride_type_has_flag(item.type, RIDE_TYPE_FLAG_28)) {
if (item.type != _lastTrackDesignCountRideType.type || item.entry_index != _lastTrackDesignCountRideType.entry_index) {
_lastTrackDesignCountRideType = item;
_lastTrackDesignCount = get_num_track_designs(item);
@@ -961,7 +960,7 @@ static void window_new_ride_paint_ride_information(rct_window *w, rct_drawpixeli
// Get price of ride
int unk2 = RCT2_GLOBAL(0x0097CC68 + (item.type * 2), uint8);
money32 price = RCT2_GLOBAL(0x0097DD78 + (item.type * 4), uint16);
if (rideTypeFlags & 0x80000) {
if (ride_type_has_flag(item.type, RIDE_TYPE_FLAG_19)) {
price *= RCT2_ADDRESS(0x0099DE34, uint32)[unk2];
} else {
price *= RCT2_ADDRESS(0x0099DA34, uint32)[unk2];
@@ -970,7 +969,7 @@ static void window_new_ride_paint_ride_information(rct_window *w, rct_drawpixeli
//
rct_string_id stringId = 1691;
if (!(rideTypeFlags & 0x8000))
if (!ride_type_has_flag(item.type, RIDE_TYPE_FLAG_15))
stringId++;
gfx_draw_string_right(dpi, stringId, &price, 0, x + width, y + 40);
@@ -989,8 +988,7 @@ static void window_new_ride_select(rct_window *w)
window_close(w);
uint32 rideTypeFlags = RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (item.type * 8), uint32);
if (rideTypeFlags & 0x10000000) {
if (ride_type_has_flag(item.type, RIDE_TYPE_FLAG_28)) {
track_load_list(item);
uint8 *trackDesignList = (uint8*)0x00F441EC;

View File

@@ -1241,7 +1241,7 @@ rct_window *window_ride_open_station(int rideIndex, int stationIndex)
ride = GET_RIDE(rideIndex);
if (RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8), uint32) & 0x2000)
if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_13))
return window_ride_main_open(rideIndex);
w = window_bring_to_front_by_number(WC_RIDE, rideIndex);
@@ -1509,9 +1509,8 @@ static void window_ride_init_viewport(rct_window *w)
focus.coordinate.z = map_element_height(focus.coordinate.x, focus.coordinate.y) & 0xFFFF;
focus.sprite.type |= 0x40;
focus.coordinate.zoom = 1;
if (RCT2_GLOBAL(0x0097CF40 + (ride->type * 8), uint32) & 0x8000){
if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_15))
focus.coordinate.zoom = 0;
}
}
focus.coordinate.var_480 = w->viewport_focus_coordinates.var_480;
@@ -1682,7 +1681,7 @@ static void window_ride_show_view_dropdown(rct_window *w, rct_widget *widget)
ride = GET_RIDE(w->number);
numItems = 1;
if (!(RCT2_GLOBAL(0x0097CF40 + (ride->type * 8), uint32) & 0x2000)) {
if (!ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_13)) {
numItems += ride->num_stations;
numItems += ride->num_vehicles;
}
@@ -1747,7 +1746,7 @@ static void window_ride_show_open_dropdown(rct_window *w, rct_widget *widget)
gDropdownItemsArgs[numItems] = STR_CLOSE_RIDE;
numItems++;
if (!(RCT2_GLOBAL(0x0097CF40 + (ride->type * 8), uint32) & 0x800)) {
if (!ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_11)) {
gDropdownItemsFormat[numItems] = 1142;
gDropdownItemsArgs[numItems] = STR_TEST_RIDE;
numItems++;
@@ -1774,7 +1773,7 @@ static void window_ride_show_open_dropdown(rct_window *w, rct_widget *widget)
break;
highlightedIndex = 2;
if (RCT2_GLOBAL(0x0097CF40 + (ride->type * 8), uint32) & 0x800)
if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_11))
break;
if (ride->lifecycle_flags & RIDE_LIFECYCLE_TESTED)
break;
@@ -1796,7 +1795,7 @@ static void window_ride_show_open_dropdown(rct_window *w, rct_widget *widget)
if (checkedIndex != RIDE_STATUS_CLOSED)
checkedIndex = 3 - checkedIndex;
if (RCT2_GLOBAL(0x0097CF40 + (ride->type * 8), uint32) & 0x800) {
if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_11)) {
if (checkedIndex != 0)
checkedIndex--;
if (highlightedIndex != 0)
@@ -1858,7 +1857,7 @@ static void window_ride_main_dropdown()
dropdownIndex = RCT2_GLOBAL(0x009DEBA2, sint16);
ride = GET_RIDE(w->number);
if ((RCT2_GLOBAL(0x0097CF40 + (ride->type * 8), uint32) & 0x800) && dropdownIndex != 0)
if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_11) && dropdownIndex != 0)
dropdownIndex++;
switch (dropdownIndex) {
@@ -2657,7 +2656,7 @@ static void window_ride_mode_tweak_set(rct_window *w, uint8 value)
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = 1361;
if (ride->mode == RIDE_MODE_RACE)
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = 1738;
if (RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8), uint32) & 0x2000)
if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_13))
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = 1746;
if (ride->mode == RIDE_MODE_BUMPERCAR)
RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, uint16) = 1751;
@@ -3015,7 +3014,7 @@ static void window_ride_operating_invalidate()
// Leave if another vehicle arrives at station
if (
(RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8), uint32) & 0x10) &&
ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_4) &&
ride->num_vehicles > 1 &&
ride->mode != RIDE_MODE_CONTINUOUS_CIRCUIT_BLOCK_SECTIONED &&
ride->mode != RIDE_MODE_POWERED_LAUNCH_BLOCK_SECTIONED
@@ -3030,7 +3029,7 @@ static void window_ride_operating_invalidate()
}
// Synchronise with adjacent stations
if (RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8), uint32) & 0x20) {
if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_5)) {
window_ride_operating_widgets[WIDX_SYNCHRONISE_WITH_ADJACENT_STATIONS_CHECKBOX].type = WWT_CHECKBOX;
window_ride_operating_widgets[WIDX_SYNCHRONISE_WITH_ADJACENT_STATIONS_CHECKBOX].image = STR_SYNCHRONISE_WITH_ADJACENT_STATIONS;
window_ride_operating_widgets[WIDX_SYNCHRONISE_WITH_ADJACENT_STATIONS_CHECKBOX].tooltip = STR_SYNCHRONISE_WITH_ADJACENT_STATIONS_TIP;
@@ -3043,7 +3042,7 @@ static void window_ride_operating_invalidate()
// Waiting
window_ride_operating_widgets[WIDX_LOAD].image = STR_QUARTER_LOAD + (ride->depart_flags & RIDE_DEPART_WAIT_FOR_LOAD_MASK);
if (RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8), uint32) & 0x4000) {
if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_14)) {
window_ride_operating_widgets[WIDX_LOAD_CHECKBOX].type = WWT_CHECKBOX;
window_ride_operating_widgets[WIDX_LOAD].type = WWT_DROPDOWN;
window_ride_operating_widgets[WIDX_LOAD_DROPDOWN].type = WWT_DROPDOWN_BUTTON;
@@ -3135,7 +3134,7 @@ static void window_ride_operating_invalidate()
format = 1736;
caption = STR_MAX_PEOPLE_ON_RIDE;
tooltip = STR_MAX_PEOPLE_ON_RIDE_TIP;
if (!(RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8), uint32) & 0x2000))
if (!ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_13))
format = 0;
break;
}
@@ -3523,12 +3522,11 @@ static uint32 window_ride_get_colour_button_image(int colour)
static int window_ride_has_track_colour(rct_ride *ride, int trackColour)
{
uint16 unk_1 = RCT2_GLOBAL(0x00993E20 + (ride->entrance_style * 8), uint16);
uint32 unk_2 = RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8), uint32);
switch (trackColour) {
case 0: return ((unk_1 & 1) && !(unk_2 & 0x20000)) || (unk_2 & 1);
case 1: return ((unk_1 & 2) && !(unk_2 & 0x20000)) || (unk_2 & 2);
case 2: return unk_2 & 4;
case 0: return ((unk_1 & 1) && !ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_17)) || ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_0);
case 1: return ((unk_1 & 2) && !ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_17)) || ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_1);
case 2: return ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_2);
default: return 0;
}
}
@@ -3921,7 +3919,7 @@ static void window_ride_colour_invalidate()
}
// Track, multiple colour schemes
if (RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8), uint32) & 0x80000000) {
if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_31)) {
window_ride_colour_widgets[WIDX_TRACK_COLOUR_SCHEME].type = WWT_DROPDOWN;
window_ride_colour_widgets[WIDX_TRACK_COLOUR_SCHEME_DROPDOWN].type = WWT_DROPDOWN_BUTTON;
window_ride_colour_widgets[WIDX_PAINT_INDIVIDUAL_AREA].type = WWT_FLATBTN;
@@ -3956,7 +3954,7 @@ static void window_ride_colour_invalidate()
}
// Track preview
if (RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8), uint32) & 7)
if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_0 | RIDE_TYPE_FLAG_1 | RIDE_TYPE_FLAG_2))
window_ride_colour_widgets[WIDX_TRACK_PREVIEW].type = WWT_SPINNER;
else
window_ride_colour_widgets[WIDX_TRACK_PREVIEW].type = WWT_EMPTY;
@@ -3975,10 +3973,7 @@ static void window_ride_colour_invalidate()
}
// Vehicle colours
if (
!(RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8), uint32) & 0x2000) &&
(RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8), uint32) & 0x4000000)
) {
if (!ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_13) && ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_26)) {
vehicleColourSchemeType = ride->colour_scheme_type & 3;
if (vehicleColourSchemeType == 0)
w->var_48C = 0;
@@ -4016,10 +4011,7 @@ static void window_ride_colour_invalidate()
}
// Vehicle colour scheme type
if (
!(RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8), uint32) & 0x10000) &&
(ride->num_cars_per_train | ride->num_vehicles) > 1
) {
if (!ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_16) && (ride->num_cars_per_train | ride->num_vehicles) > 1) {
window_ride_colour_widgets[WIDX_VEHICLE_COLOUR_SCHEME].type = WWT_DROPDOWN;
window_ride_colour_widgets[WIDX_VEHICLE_COLOUR_SCHEME_DROPDOWN].type = WWT_DROPDOWN_BUTTON;
} else {
@@ -4705,7 +4697,7 @@ static void window_ride_measurements_invalidate()
window_ride_measurements_widgets[WIDX_SAVE_DESIGN].type = WWT_EMPTY;
window_ride_measurements_widgets[WIDX_CANCEL_DESIGN].type = WWT_EMPTY;
if (!(ride->lifecycle_flags & RIDE_LIFECYCLE_19)) {
if (RCT2_GLOBAL(0x0097CF40 + (ride->type * 8), uint32) & 0x10000000) {
if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_28)) {
window_ride_measurements_widgets[WIDX_SAVE_TRACK_DESIGN].type = WWT_FLATBTN;
w->disabled_widgets |= (1 << WIDX_SAVE_TRACK_DESIGN);
if (ride->lifecycle_flags & RIDE_LIFECYCLE_TESTED) {
@@ -4857,7 +4849,7 @@ static void window_ride_measurements_paint()
gfx_draw_string_left_clipped(dpi, STR_RIDE_LENGTH, (void*)0x013CE952, 0, x, y, 308);
y += 10;
if (RCT2_GLOBAL(0x0097CF40 + (ride->type * 8), uint32) & 0x80) {
if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_7)) {
// Max. positive vertical G's
maxPositiveVerticalGs = ride->max_positive_vertical_g;
stringId = maxPositiveVerticalGs >= FIXED_2DP(5,00) ?
@@ -4885,7 +4877,7 @@ static void window_ride_measurements_paint()
y += 10;
}
if (RCT2_GLOBAL(0x0097CF40 + (ride->type * 8), uint32) & 0x400) {
if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_10)) {
// Drops
drops = ride->drops & 0x3F;
gfx_draw_string_left(dpi, STR_DROPS, &drops, 0, x, y);
@@ -5151,7 +5143,7 @@ static void window_ride_graphs_invalidate()
w->pressed_widgets |= (1LL << (WIDX_GRAPH_VELOCITY + (w->list_information_type & 0xFF)));
// Hide graph buttons that are not applicable
if (RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8), uint32) & 0x80) {
if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_7)) {
window_ride_graphs_widgets[WIDX_GRAPH_VERTICAL].type = WWT_DROPDOWN_BUTTON;
window_ride_graphs_widgets[WIDX_GRAPH_LATERAL].type = WWT_DROPDOWN_BUTTON;
} else {
@@ -5767,13 +5759,13 @@ static void window_ride_customer_invalidate()
RCT2_GLOBAL(0x013CE952 + 0, uint16) = ride->name;
RCT2_GLOBAL(0x013CE952 + 2, uint32) = ride->name_arguments;
if (RCT2_GLOBAL(0x0097CF40 + (ride->type * 8), uint32) * 0x20000) {
window_ride_customer_widgets[WIDX_SHOW_GUESTS_THOUGHTS].type = WWT_FLATBTN;
window_ride_customer_widgets[WIDX_SHOW_GUESTS_ON_RIDE].type = WWT_FLATBTN;
window_ride_customer_widgets[WIDX_SHOW_GUESTS_QUEUING].type = WWT_FLATBTN;
} else {
window_ride_customer_widgets[WIDX_SHOW_GUESTS_THOUGHTS].type = WWT_FLATBTN;
if (ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_17)) {
window_ride_customer_widgets[WIDX_SHOW_GUESTS_ON_RIDE].type = WWT_EMPTY;
window_ride_customer_widgets[WIDX_SHOW_GUESTS_QUEUING].type = WWT_EMPTY;
} else {
window_ride_customer_widgets[WIDX_SHOW_GUESTS_ON_RIDE].type = WWT_FLATBTN;
window_ride_customer_widgets[WIDX_SHOW_GUESTS_QUEUING].type = WWT_FLATBTN;
}
window_ride_anchor_border_widgets(w);

View File

@@ -520,7 +520,7 @@ static void window_track_list_paint()
y += 10;
}
if (RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (track_td6->type * 8), uint32) & 0x80) {
if (ride_type_has_flag(track_td6->type, RIDE_TYPE_FLAG_7)) {
// Maximum positive vertical Gs
gForces = track_td6->max_positive_vertical_g * 32;
gfx_draw_string_left(dpi, STR_MAX_POSITIVE_VERTICAL_G, &gForces, 0, x, y);
@@ -546,7 +546,7 @@ static void window_track_list_paint()
}
}
if (RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (track_td6->type * 8), uint32) & 0x400) {
if (ride_type_has_flag(track_td6->type, RIDE_TYPE_FLAG_10)) {
// Drops
drops = track_td6->drops & 0x3F;
gfx_draw_string_left(dpi, STR_DROPS, &drops, 0, x, y);

View File

@@ -385,9 +385,9 @@ static int park_calculate_guest_generation_probability()
if (ride->lifecycle_flags & RIDE_LIFECYCLE_CRASHED)
continue;
if (!(RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8), uint32) & 0x10000000))
if (!ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_28))
continue;
if (!(RCT2_GLOBAL(RCT2_ADDRESS_RIDE_FLAGS + (ride->type * 8), uint32) & 0x200))
if (!ride_type_has_flag(ride->type, RIDE_TYPE_FLAG_9))
continue;
if (!(ride->lifecycle_flags & RIDE_LIFECYCLE_TESTED))
continue;