Revert #3147 and fix construction issue. Revert most of c7c1f86 and rework to prevent issues

This commit is contained in:
duncanspumpkin 2016-03-19 08:27:52 +00:00 committed by IntelOrca
parent 4e60f0db42
commit 8c7dfd3097
3 changed files with 10 additions and 12 deletions

View File

@ -5157,6 +5157,15 @@ int ride_is_valid_for_open(int rideIndex, int goingToBeOpen, int isApplying)
ride = get_ride(rideIndex);
// Check to see if construction tool in use. If it is close the construction window
// to set the track to its final state and clean up ghosts.
// We can't just call close as it would cause a stack overflow during shop creation
// with auto open on.
if (WC_RIDE_CONSTRUCTION == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWCLASS, rct_windowclass) &&
rideIndex == RCT2_GLOBAL(RCT2_ADDRESS_TOOL_WINDOWNUMBER, rct_windownumber) &&
(gInputFlags & INPUT_FLAG_TOOL_ACTIVE))
window_close_by_number(WC_RIDE_CONSTRUCTION, rideIndex);
stationIndex = ride_mode_check_station_present(ride);
if (stationIndex == -1)return 0;

View File

@ -6597,9 +6597,6 @@ void sub_6DBF3E(rct_vehicle *vehicle)
trackType,
0
);
if (mapElement == NULL) {
return;
}
if (RCT2_GLOBAL(0x00F64E1C, uint32) == 0xFFFFFFFF) {
RCT2_GLOBAL(0x00F64E1C, uint32) = (mapElement->properties.track.sequence >> 4) & 7;
}
@ -6666,9 +6663,6 @@ bool vehicle_update_track_motion_forwards_get_new_track(rct_vehicle *vehicle, ui
trackType,
0
);
if (mapElement == NULL) {
return false;
}
if (trackType == TRACK_ELEM_CABLE_LIFT_HILL && vehicle == RCT2_GLOBAL(0x00F64E04, rct_vehicle*)) {
RCT2_GLOBAL(0x00F64E18, uint32) |= VEHICLE_UPDATE_MOTION_TRACK_FLAG_11;
}

View File

@ -592,6 +592,7 @@ static void window_ride_construction_close(rct_window *w)
uint8 rideIndex = _currentRideIndex;
if (ride_try_get_origin_element(rideIndex, NULL)) {
rct_ride *ride = get_ride(rideIndex);
// Auto open shops if required.
if (ride->mode == RIDE_MODE_SHOP_STALL && gConfigGeneral.auto_open_shops) {
ride_set_status(rideIndex, RIDE_STATUS_OPEN);
}
@ -1928,12 +1929,6 @@ 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);
if (ride == NULL || ride->status != RIDE_STATUS_CLOSED || _deferClose) {
window_close(w);
return;
}
switch (_currentTrackCurve) {
case 429:
case 376: