diff --git a/src/windows/ride.c b/src/windows/ride.c index 23356b52e7..fabb93752d 100644 --- a/src/windows/ride.c +++ b/src/windows/ride.c @@ -1544,9 +1544,8 @@ static rct_window *window_ride_open(int rideIndex) w->max_width = 500; w->max_height = 450; - window_ride_update_overall_view((uint8) rideIndex); - ride = get_ride(rideIndex); + _rideType = ride->type; numSubTypes = 0; rideEntryIndexPtr = get_ride_entry_indices_for_ride_type(ride->type); for (; *rideEntryIndexPtr != 0xFF; rideEntryIndexPtr++) { @@ -1555,7 +1554,9 @@ static rct_window *window_ride_open(int rideIndex) } } var_496(w) = numSubTypes; - _rideType = ride->type; + + window_ride_update_overall_view((uint8) rideIndex); + return w; } @@ -1626,6 +1627,7 @@ rct_window *window_ride_open_station(int rideIndex, int stationIndex) ) { tool_cancel(); } + _rideType = ride->type; w->page = WINDOW_RIDE_PAGE_MAIN; w->width = 316; @@ -1648,7 +1650,6 @@ rct_window *window_ride_open_station(int rideIndex, int stationIndex) w->ride.view = 1 + ride->num_vehicles + stationIndex; window_ride_init_viewport(w); - _rideType = ride->type; return w; } @@ -1737,6 +1738,7 @@ rct_window *window_ride_open_vehicle(rct_vehicle *vehicle) w->ride.var_482 = -1; } + _rideType = ride->type; w->page = WINDOW_RIDE_PAGE_MAIN; w->width = 316; w->height = 180; @@ -1752,7 +1754,6 @@ rct_window *window_ride_open_vehicle(rct_vehicle *vehicle) w->ride.view = view; window_ride_init_viewport(w); - _rideType = ride->type; window_invalidate(w); return w; @@ -2043,16 +2044,17 @@ static void window_ride_main_resize(rct_window *w) rct_viewport *viewport; int width, height; + const int offset = gCheatsAllowArbitraryRideTypeChanges ? 15 : 0; w->flags |= WF_RESIZABLE; - int minHeight = 195; + int minHeight = 180 + offset; if (theme_get_flags() & UITHEME_FLAG_USE_LIGHTS_RIDE) - minHeight = 215 + RCT1_LIGHT_OFFSET - (ride_type_has_flag(get_ride(w->number)->type, RIDE_TYPE_FLAG_NO_TEST_MODE) ? 14 : 0); + minHeight = 200 + offset + RCT1_LIGHT_OFFSET - (ride_type_has_flag(get_ride(w->number)->type, RIDE_TYPE_FLAG_NO_TEST_MODE) ? 14 : 0); window_set_resize(w, 316, minHeight, 500, 450); viewport = w->viewport; if (viewport != NULL) { width = w->width - 30; - height = w->height - 90; + height = w->height - (75 + offset); if (viewport->width != width || viewport->height != height) { viewport->width = width; viewport->height = height; @@ -2223,6 +2225,7 @@ static void window_ride_main_mousedown(int widgetIndex, rct_window *w, rct_widge } else { _rideType++; } + widget_invalidate(w, WIDX_RIDE_TYPE); break; case WIDX_RIDE_TYPE_DECREASE: if (_rideType == 0) { @@ -2230,11 +2233,13 @@ static void window_ride_main_mousedown(int widgetIndex, rct_window *w, rct_widge } else { _rideType--; } + widget_invalidate(w, WIDX_RIDE_TYPE); break; case WIDX_RIDE_TYPE_APPLY: if (_rideType >= 0 && _rideType <= 90) { set_operating_setting(w->number, RIDE_SETTING_RIDE_TYPE, _rideType); } + window_invalidate_all(); break; } } @@ -2400,33 +2405,37 @@ static void window_ride_main_invalidate(rct_window *w) window_ride_anchor_border_widgets(w); + const int offset = gCheatsAllowArbitraryRideTypeChanges ? 15 : 0; // Anchor main page specific widgets window_ride_main_widgets[WIDX_VIEWPORT].right = w->width - 26; - window_ride_main_widgets[WIDX_VIEWPORT].bottom = w->height - 129; + window_ride_main_widgets[WIDX_VIEWPORT].bottom = w->height - (14 + offset); window_ride_main_widgets[WIDX_STATUS].right = w->width - 26; - window_ride_main_widgets[WIDX_STATUS].top = w->height - 28; - window_ride_main_widgets[WIDX_STATUS].bottom = w->height - 18; + window_ride_main_widgets[WIDX_STATUS].top = w->height - (13 + offset); + window_ride_main_widgets[WIDX_STATUS].bottom = w->height - (3 + offset); window_ride_main_widgets[WIDX_VIEW].right = w->width - 60; window_ride_main_widgets[WIDX_VIEW_DROPDOWN].right = w->width - 61; window_ride_main_widgets[WIDX_VIEW_DROPDOWN].left = w->width - 71; window_ride_main_widgets[WIDX_RIDE_TYPE].right = w->width - 80; - window_ride_main_widgets[WIDX_RIDE_TYPE].top = w->height - 15; - window_ride_main_widgets[WIDX_RIDE_TYPE].bottom = w->height - 3; + window_ride_main_widgets[WIDX_RIDE_TYPE].top = w->height - 17; + window_ride_main_widgets[WIDX_RIDE_TYPE].bottom = w->height - 4; window_ride_main_widgets[WIDX_RIDE_TYPE_INCREASE].right = w->width - 81; window_ride_main_widgets[WIDX_RIDE_TYPE_INCREASE].left = w->width - 91; - window_ride_main_widgets[WIDX_RIDE_TYPE_INCREASE].top = w->height - 14; - window_ride_main_widgets[WIDX_RIDE_TYPE_INCREASE].bottom = w->height - 9; + window_ride_main_widgets[WIDX_RIDE_TYPE_INCREASE].top = w->height - 16; + window_ride_main_widgets[WIDX_RIDE_TYPE_INCREASE].bottom = w->height - 11; window_ride_main_widgets[WIDX_RIDE_TYPE_DECREASE].right = w->width - 81; window_ride_main_widgets[WIDX_RIDE_TYPE_DECREASE].left = w->width - 91; - window_ride_main_widgets[WIDX_RIDE_TYPE_DECREASE].top = w->height - 8; - window_ride_main_widgets[WIDX_RIDE_TYPE_DECREASE].bottom = w->height - 3; + window_ride_main_widgets[WIDX_RIDE_TYPE_DECREASE].top = w->height - 10; + window_ride_main_widgets[WIDX_RIDE_TYPE_DECREASE].bottom = w->height - 5; window_ride_main_widgets[WIDX_RIDE_TYPE_APPLY].left = w->width - 78; window_ride_main_widgets[WIDX_RIDE_TYPE_APPLY].right = w->width - 25; - window_ride_main_widgets[WIDX_RIDE_TYPE_APPLY].top = w->height - 15; - window_ride_main_widgets[WIDX_RIDE_TYPE_APPLY].bottom = w->height - 3; + window_ride_main_widgets[WIDX_RIDE_TYPE_APPLY].top = w->height - 17; + window_ride_main_widgets[WIDX_RIDE_TYPE_APPLY].bottom = w->height - 4; + + widget_invalidate(w, WIDX_VIEWPORT); + widget_invalidate(w, WIDX_VIEW); if (!gCheatsAllowArbitraryRideTypeChanges) { - window_ride_main_widgets[WIDX_RIDE_TYPE].type = WWT_14; + window_ride_main_widgets[WIDX_RIDE_TYPE].type = WWT_EMPTY; window_ride_main_widgets[WIDX_RIDE_TYPE_INCREASE].type = WWT_EMPTY; window_ride_main_widgets[WIDX_RIDE_TYPE_DECREASE].type = WWT_EMPTY; window_ride_main_widgets[WIDX_RIDE_TYPE_APPLY].type = WWT_EMPTY;