diff --git a/data/language/english_uk.txt b/data/language/english_uk.txt index 3628b2e879..f69061e519 100644 --- a/data/language/english_uk.txt +++ b/data/language/english_uk.txt @@ -3454,4 +3454,5 @@ STR_3446 :Cancel Patrol Area # New strings, cleaner STR_5120 :Show finances button on toolbar -STR_5121 :Show research button on toolbar \ No newline at end of file +STR_5121 :Show research button on toolbar +STR_5122 :Show all vehicles sharing a track/ride type diff --git a/src/config.c b/src/config.c index accecfb556..c8b4b6e515 100644 --- a/src/config.c +++ b/src/config.c @@ -165,6 +165,7 @@ config_property_definition _generalDefinitions[] = { config_property_definition _interfaceDefinitions[] = { { offsetof(interface_configuration, toolbar_show_finances), "toolbar_show_finances", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL }, { offsetof(interface_configuration, toolbar_show_research), "toolbar_show_research", CONFIG_VALUE_TYPE_BOOLEAN, true, NULL }, + { offsetof(interface_configuration, allow_subtype_switching), "allow_subtype_switching", CONFIG_VALUE_TYPE_BOOLEAN, false, NULL }, }; config_property_definition _soundDefinitions[] = { @@ -951,4 +952,4 @@ bool config_shortcut_keys_save() return result; } -#pragma endregion \ No newline at end of file +#pragma endregion diff --git a/src/config.h b/src/config.h index 0099b44fd6..5c3302a022 100644 --- a/src/config.h +++ b/src/config.h @@ -134,6 +134,7 @@ typedef struct { typedef struct { uint8 toolbar_show_finances; uint8 toolbar_show_research; + uint8 allow_subtype_switching; } interface_configuration; typedef struct { diff --git a/src/windows/options.c b/src/windows/options.c index e5536b3925..832ce790c6 100644 --- a/src/windows/options.c +++ b/src/windows/options.c @@ -95,7 +95,9 @@ enum WINDOW_OPTIONS_WIDGET_IDX { WIDX_REAL_NAME_CHECKBOX, WIDX_SAVE_PLUGIN_DATA_CHECKBOX, WIDX_AUTOSAVE, - WIDX_AUTOSAVE_DROPDOWN + WIDX_AUTOSAVE_DROPDOWN, + WIDX_ALLOW_SUBTYPE_SWITCHING, + WINDOW_OPTIONS_WIDGETS_SIZE // Marks the end of the widget list, leave as last item }; #define WW 310 @@ -153,6 +155,7 @@ static rct_widget window_options_widgets[] = { { WWT_CHECKBOX, 2, 10, 299, 68, 79, STR_SAVE_PLUGIN_DATA, STR_SAVE_PLUGIN_DATA_TIP }, { WWT_DROPDOWN, 0, 155, 299, 83, 94, STR_NONE, STR_NONE }, { WWT_DROPDOWN_BUTTON, 0, 288, 298, 84, 93, 876, STR_NONE }, + { WWT_CHECKBOX, 2, 10, 299, 98, 109, 5122, STR_NONE }, // allow subtype switching { WIDGETS_END }, }; @@ -258,7 +261,8 @@ void window_options_open() (1ULL << WIDX_GRIDLINES_CHECKBOX) | (1ULL << WIDX_SAVE_PLUGIN_DATA_CHECKBOX) | (1ULL << WIDX_AUTOSAVE) | - (1ULL << WIDX_AUTOSAVE_DROPDOWN); + (1ULL << WIDX_AUTOSAVE_DROPDOWN) | + (1ULL << WIDX_ALLOW_SUBTYPE_SWITCHING); w->page = WINDOW_OPTIONS_PAGE_DISPLAY; window_init_scroll_widgets(w); @@ -309,6 +313,12 @@ static void window_options_mouseup() window_invalidate(w); window_invalidate_by_class(WC_TOP_TOOLBAR); break; + case WIDX_ALLOW_SUBTYPE_SWITCHING: + gConfigInterface.allow_subtype_switching ^= 1; + config_save_default(); + window_invalidate(w); + window_invalidate_by_class(WC_RIDE); + break; case WIDX_REAL_NAME_CHECKBOX: RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) ^= PARK_FLAGS_SHOW_REAL_GUEST_NAMES; RCT2_CALLPROC_X(0x0069C52F, RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_SHOW_REAL_GUEST_NAMES ? 0 : 1, 0, 0, 0, 0, 0, 0); @@ -634,7 +644,7 @@ static void window_options_invalidate() window_get_register(w); window_options_set_pressed_tab(w); - for (i = WIDX_RESOLUTION; i <= WIDX_AUTOSAVE_DROPDOWN; i++) { + for (i = WIDX_RESOLUTION; i < WINDOW_OPTIONS_WIDGETS_SIZE; i++) { window_options_widgets[i].type = WWT_EMPTY; } @@ -741,6 +751,8 @@ static void window_options_invalidate() window_options_widgets[WIDX_TOOLBAR_SHOW_RESEARCH].type = WWT_CHECKBOX; break; case WINDOW_OPTIONS_PAGE_MISC: + widget_set_checkbox_value(w, WIDX_ALLOW_SUBTYPE_SWITCHING, gConfigInterface.allow_subtype_switching); + // real name checkbox if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_SHOW_REAL_GUEST_NAMES) w->pressed_widgets |= (1ULL << WIDX_REAL_NAME_CHECKBOX); @@ -767,6 +779,7 @@ static void window_options_invalidate() window_options_widgets[WIDX_SAVE_PLUGIN_DATA_CHECKBOX].type = WWT_CHECKBOX; window_options_widgets[WIDX_AUTOSAVE].type = WWT_DROPDOWN; window_options_widgets[WIDX_AUTOSAVE_DROPDOWN].type = WWT_DROPDOWN_BUTTON; + window_options_widgets[WIDX_ALLOW_SUBTYPE_SWITCHING].type = WWT_CHECKBOX; break; } } @@ -911,4 +924,4 @@ static void window_options_draw_tab_images(rct_drawpixelinfo *dpi, rct_window *w window_options_draw_tab_image(dpi, w, WINDOW_OPTIONS_PAGE_MISC, 5205); } -#pragma endregion \ No newline at end of file +#pragma endregion diff --git a/src/windows/ride.c b/src/windows/ride.c index 3ac839dea9..ff84a7e466 100644 --- a/src/windows/ride.c +++ b/src/windows/ride.c @@ -19,6 +19,7 @@ *****************************************************************************/ #include "../addresses.h" +#include "../config.h" #include "../game.h" #include "../input.h" #include "../interface/viewport.h" @@ -2279,7 +2280,8 @@ static void window_ride_vehicle_mousedown(int widgetIndex, rct_window *w, rct_wi for (currentRideEntryIndex = rideEntryIndexPtr; *currentRideEntryIndex != 0xFF; currentRideEntryIndex++) { rideEntryIndex = *currentRideEntryIndex; currentRideEntry = GET_RIDE_ENTRY(rideEntryIndex); - if (currentRideEntry->var_008 & 0x3000) + // Skip if vehicle has the same track type, but not same subtype, unless subtype switching is enabled + if ((currentRideEntry->var_008 & 0x3000) && !gConfigInterface.allow_subtype_switching) continue; quadIndex = rideEntryIndex >> 5; @@ -2438,7 +2440,8 @@ static void window_ride_vehicle_invalidate() // Vehicle type window_ride_vehicle_widgets[WIDX_VEHICLE_TYPE].image = rideEntry->name; - if (var_496(w) <= 1 || (rideEntry->var_008 & (1 << 13))) { + // Always show a dropdown button when changing subtypes is allowed + if ((var_496(w) <= 1 || (rideEntry->var_008 & (1 << 13))) && !gConfigInterface.allow_subtype_switching ) { window_ride_vehicle_widgets[WIDX_VEHICLE_TYPE].type = WWT_14; window_ride_vehicle_widgets[WIDX_VEHICLE_TYPE_DROPDOWN].type = WWT_EMPTY; w->enabled_widgets &= ~(1 << WIDX_VEHICLE_TYPE); @@ -5883,4 +5886,4 @@ static void window_ride_customer_paint() gfx_draw_string_left(dpi, stringId, &age, 0, x, y); } -#pragma endregion \ No newline at end of file +#pragma endregion