1
0
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:
IntelOrca
2015-02-25 18:26:37 +00:00
parent b53c828ae4
commit ae69718b53
2 changed files with 11 additions and 23 deletions

View File

@@ -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);
}
}
/**

View File

@@ -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);
}
/**