From fabef9b050748246c71bd11dd542dfafa59a6acf Mon Sep 17 00:00:00 2001 From: Tulio Leao Date: Sun, 19 Jan 2020 14:04:53 -0300 Subject: [PATCH] Modify height search to also affect maze construction --- src/openrct2-ui/windows/RideConstruction.cpp | 23 ++++++++------------ src/openrct2/network/Network.cpp | 2 +- 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/openrct2-ui/windows/RideConstruction.cpp b/src/openrct2-ui/windows/RideConstruction.cpp index 2c9406bba4..5485defd3a 100644 --- a/src/openrct2-ui/windows/RideConstruction.cpp +++ b/src/openrct2-ui/windows/RideConstruction.cpp @@ -3550,7 +3550,6 @@ void ride_construction_toolupdate_construct(ScreenCoordsXY screenCoords) z -= bx; gMapSelectArrowPosition.z = z; - bx = 41; _currentTrackBegin.x = mapCoords->x; _currentTrackBegin.y = mapCoords->y; _currentTrackBegin.z = z; @@ -3561,9 +3560,12 @@ void ride_construction_toolupdate_construct(ScreenCoordsXY screenCoords) } _previousTrackPiece = _currentTrackBegin; + // search for appropriate z value for ghost, up to max ride height + int numAttempts = (z <= (8 * MAX_TRACK_HEIGHT) ? MAX_TRACK_HEIGHT - (z / 8) + 1 : 2); + if (ride->type == RIDE_TYPE_MAZE) { - for (;;) + for (int zAttempts = numAttempts; zAttempts > 1; zAttempts--) { window_ride_construction_update_state( &trackType, &trackDirection, &rideIndex, &liftHillAndAlternativeState, &mapCoords->x, &mapCoords->y, &z, @@ -3573,16 +3575,11 @@ void ride_construction_toolupdate_construct(ScreenCoordsXY screenCoords) if (_currentTrackPrice != MONEY32_UNDEFINED) break; - bx--; - if (bx == 0) - break; - _currentTrackBegin.z -= 8; if (_currentTrackBegin.z < 0) break; - if (bx >= 0) - _currentTrackBegin.z += 16; + _currentTrackBegin.z += 16; } auto intent = Intent(INTENT_ACTION_UPDATE_MAZE_CONSTRUCTION); @@ -3591,8 +3588,6 @@ void ride_construction_toolupdate_construct(ScreenCoordsXY screenCoords) return; } - // search for appropriate z value for ghost, up to max ride height - int numAttempts = (z <= (8 * MAX_TRACK_HEIGHT) ? MAX_TRACK_HEIGHT - (z / 8) + 1 : 2); for (int zAttempts = numAttempts; zAttempts > 1; zAttempts--) { window_ride_construction_update_state( @@ -3793,9 +3788,12 @@ void ride_construction_tooldown_construct(ScreenCoordsXY screenCoords) z = _trackPlaceZ; } + // search for z value to build at, up to max ride height + int numAttempts = (z <= (8 * MAX_TRACK_HEIGHT) ? MAX_TRACK_HEIGHT - (z / 8) + 1 : 2); + if (ride->type == RIDE_TYPE_MAZE) { - for (int32_t zAttempts = 41; zAttempts >= 0; zAttempts--) + for (int32_t zAttempts = numAttempts; zAttempts > 0; zAttempts--) { _rideConstructionState = RIDE_CONSTRUCTION_STATE_MAZE_BUILD; _currentTrackBegin.x = mapCoords.x; @@ -3855,9 +3853,6 @@ void ride_construction_tooldown_construct(ScreenCoordsXY screenCoords) return; } - // search for z value to build at, up to max ride height - int numAttempts = (z <= (8 * MAX_TRACK_HEIGHT) ? MAX_TRACK_HEIGHT - (z / 8) + 1 : 2); - for (int32_t zAttempts = numAttempts; zAttempts > 0; zAttempts--) { _rideConstructionState = RIDE_CONSTRUCTION_STATE_FRONT; diff --git a/src/openrct2/network/Network.cpp b/src/openrct2/network/Network.cpp index df2bca971c..b98474ce0c 100644 --- a/src/openrct2/network/Network.cpp +++ b/src/openrct2/network/Network.cpp @@ -31,7 +31,7 @@ // This string specifies which version of network stream current build uses. // It is used for making sure only compatible builds get connected, even within // single OpenRCT2 version. -#define NETWORK_STREAM_VERSION "16" +#define NETWORK_STREAM_VERSION "17" #define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION static Peep* _pickup_peep = nullptr;