mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-23 06:44:38 +01:00
refactor ride_construct, fixes #725
This commit is contained in:
@@ -569,15 +569,18 @@ void ride_construct_new(ride_list_item listItem)
|
||||
*/
|
||||
void ride_construct(int rideIndex)
|
||||
{
|
||||
rct_xy_element trackElement;
|
||||
rct_window *w;
|
||||
|
||||
// Open construction window
|
||||
// HACK In the original game this created a mouse up event. This has been
|
||||
// replaced with a direct call to the function that gets called.
|
||||
// Eventually should be changed so the ride window does not need to be opened.
|
||||
w = window_ride_main_open(rideIndex);
|
||||
window_ride_construct(w);
|
||||
window_close_by_number(WC_RIDE, rideIndex);
|
||||
if (sub_6CAF80(rideIndex, &trackElement)) {
|
||||
ride_find_track_gap(&trackElement, &trackElement);
|
||||
|
||||
w = window_get_main();
|
||||
if (w != NULL && ride_modify(&trackElement))
|
||||
window_scroll_to_location(w, trackElement.x, trackElement.y, trackElement.element->base_height * 8);
|
||||
} else {
|
||||
sub_6CC3FB(rideIndex);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1530,23 +1530,8 @@ static void window_ride_init_viewport(rct_window *w)
|
||||
*/
|
||||
void window_ride_construct(rct_window *w)
|
||||
{
|
||||
int rideIndex = w->number;
|
||||
rct_xy_element trackElement;
|
||||
|
||||
window_close_by_class(WC_RIDE_CONSTRUCTION);
|
||||
w = window_find_by_number(WC_RIDE, rideIndex);
|
||||
if (w == NULL)
|
||||
return;
|
||||
|
||||
if (sub_6CAF80(rideIndex, &trackElement)) {
|
||||
ride_find_track_gap(&trackElement, &trackElement);
|
||||
|
||||
w = window_get_main();
|
||||
if (w != NULL && ride_modify(&trackElement))
|
||||
window_scroll_to_location(w, trackElement.x, trackElement.y, trackElement.element->base_height * 8);
|
||||
} else {
|
||||
sub_6CC3FB(rideIndex);
|
||||
}
|
||||
ride_construct(w->number);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user