mirror of https://github.com/OpenRCT2/OpenRCT2.git
fix #3183: opening ride with construction window open
Issue caused with boat hire rides as there is usually a ghost station present when the construction window is open. This causes vehicles to be created in the ghost station. Fixed by closing the construction window before the vehicles are created for the ride.
This commit is contained in:
parent
e6ca13d32c
commit
d690ee6423
|
@ -5420,6 +5420,15 @@ void game_command_set_ride_status(int *eax, int *ebx, int *ecx, int *edx, int *e
|
|||
return;
|
||||
}
|
||||
|
||||
if (*ebx & GAME_COMMAND_FLAG_APPLY) {
|
||||
// Fix #3183: Make sure we close the construction window so the ride finishes any editing code before opening
|
||||
// otherwise vehicles get added to the ride incorrectly (such as to a ghost station)
|
||||
rct_window *constructionWindow = window_find_by_number(WC_RIDE_CONSTRUCTION, rideIndex);
|
||||
if (constructionWindow != NULL) {
|
||||
window_close(constructionWindow);
|
||||
}
|
||||
}
|
||||
|
||||
if (targetStatus == RIDE_STATUS_TESTING) {
|
||||
if (!ride_is_valid_for_test(rideIndex, targetStatus == RIDE_STATUS_OPEN, *ebx & GAME_COMMAND_FLAG_APPLY)) {
|
||||
*ebx = MONEY32_UNDEFINED;
|
||||
|
|
|
@ -1678,6 +1678,7 @@ static void window_ride_rename(rct_window *w)
|
|||
*/
|
||||
static void window_ride_main_mouseup(rct_window *w, int widgetIndex)
|
||||
{
|
||||
uint8 rideIndex;
|
||||
rct_ride *ride;
|
||||
int status;
|
||||
|
||||
|
@ -1698,7 +1699,11 @@ static void window_ride_main_mouseup(rct_window *w, int widgetIndex)
|
|||
window_ride_set_page(w, widgetIndex - WIDX_TAB_1);
|
||||
break;
|
||||
case WIDX_CONSTRUCTION:
|
||||
ride_construct((uint8)w->number);
|
||||
rideIndex = (uint8)w->number;
|
||||
ride_construct(rideIndex);
|
||||
if (window_find_by_number(WC_RIDE_CONSTRUCTION, rideIndex) != NULL) {
|
||||
window_close(w);
|
||||
}
|
||||
break;
|
||||
case WIDX_RENAME:
|
||||
window_ride_rename(w);
|
||||
|
|
|
@ -1929,6 +1929,15 @@ static void window_ride_construction_exit_click(rct_window *w)
|
|||
*/
|
||||
static void window_ride_construction_update(rct_window *w)
|
||||
{
|
||||
rct_ride *ride = get_ride(_currentRideIndex);
|
||||
|
||||
// Close construction window if ride is not closed,
|
||||
// editing ride while open will cause many issues until properly handled
|
||||
if (ride->status != RIDE_STATUS_CLOSED) {
|
||||
window_close(w);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (_currentTrackCurve) {
|
||||
case 429:
|
||||
case 376:
|
||||
|
|
Loading…
Reference in New Issue