diff --git a/src/openrct2/windows/ride_list.c b/src/openrct2/windows/ride_list.c index b35021025c..9621c3edff 100644 --- a/src/openrct2/windows/ride_list.c +++ b/src/openrct2/windows/ride_list.c @@ -228,6 +228,7 @@ void window_ride_list_open() window->min_height = 240; window->max_width = 400; window->max_height = 700; + window_ride_list_refresh_list(window); } _window_ride_list_information_type = INFORMATION_TYPE_STATUS; window->list_information_type = 0; @@ -298,7 +299,12 @@ static void window_ride_list_resize(rct_window *w) w->height = w->min_height; } - window_ride_list_refresh_list(w); + // Refreshing the list can be a very intensive operation + // owing to its use of ride_has_any_track_elements(). + // This makes sure it's only refreshed every 64 ticks. + if (!(gCurrentTicks & 0x3f)) { + window_ride_list_refresh_list(w); + } } /** @@ -513,7 +519,7 @@ static void window_ride_list_invalidate(rct_window *w) sint32 i; rct_ride *ride; FOR_ALL_RIDES(i, ride) { - if (w->page != gRideClassifications[ride->type] || !ride_has_any_track_elements(i)) + if (w->page != gRideClassifications[ride->type]) continue; if (ride->status == RIDE_STATUS_OPEN) { if (allOpen == -1) allOpen = true; @@ -737,7 +743,7 @@ static void window_ride_list_refresh_list(rct_window *w) countA = countB = 0; FOR_ALL_RIDES(i, ride) { - if (w->page != gRideClassifications[ride->type] || !ride_has_any_track_elements(i)) + if (w->page != gRideClassifications[ride->type] || (ride->status == RIDE_STATUS_CLOSED && !ride_has_any_track_elements(i))) continue; countA++; @@ -756,7 +762,7 @@ static void window_ride_list_refresh_list(rct_window *w) w->no_list_items = countA; sint32 list_index = 0; FOR_ALL_RIDES(i, ride) { - if (w->page != gRideClassifications[ride->type] || !ride_has_any_track_elements(i)) + if (w->page != gRideClassifications[ride->type] || (ride->status == RIDE_STATUS_CLOSED && !ride_has_any_track_elements(i))) continue; w->list_item_positions[list_index] = i; @@ -914,7 +920,7 @@ static void window_ride_list_close_all(rct_window *w) rct_ride *ride; FOR_ALL_RIDES(i, ride) { - if (w->page != gRideClassifications[ride->type] || !ride_has_any_track_elements(i)) + if (w->page != gRideClassifications[ride->type]) continue; if (ride->status == RIDE_STATUS_CLOSED) continue; @@ -933,7 +939,7 @@ static void window_ride_list_open_all(rct_window *w) rct_ride *ride; FOR_ALL_RIDES(i, ride) { - if (w->page != gRideClassifications[ride->type] || !ride_has_any_track_elements(i)) + if (w->page != gRideClassifications[ride->type]) continue; if (ride->status == RIDE_STATUS_OPEN) continue;