Fix #8064 Ride construction errors shown as (undefined string)

The search for height to build track ended at a half-height, leading to (undefined string) error. Changed to always end at whole height and search as high as possible.
This commit is contained in:
aw20368 2019-06-16 08:52:54 -04:00 committed by Tulio Leao
parent 723f658dbd
commit c76378bc8b
3 changed files with 14 additions and 14 deletions

View File

@ -98,6 +98,7 @@
- Fix: [#7700, #8079, #8969] Crash when unloading buggy custom rides.
- Fix: [#7829] Rotated information kiosk can cause 'unreachable' messages.
- Fix: [#7878] Scroll shortcut keys ignore SHIFT/CTRL/ALT modifiers.
- Fix: [#8064] Ride construction errors shown as (undefined string)
- Fix: [#8219] Faulty folder recreation in "save" folder.
- Fix: [#8480, #8535] Crash when mirroring track design.
- Fix: [#8507] Incorrect change in vehicle rolling direction.

View File

@ -3591,7 +3591,9 @@ void ride_construction_toolupdate_construct(ScreenCoordsXY screenCoords)
return;
}
for (;;)
// search for appropriate z value for ghost, up to max ride height (2^12 - 16)
int numAttempts = (z <= 2032 ? (2032 - z) / 8 + 1 : 2);
for (int zAttempts = numAttempts; zAttempts > 1; zAttempts--)
{
window_ride_construction_update_state(
&trackType, &trackDirection, &rideIndex, &liftHillAndAlternativeState, &mapCoords->x, &mapCoords->y, &z, nullptr);
@ -3600,16 +3602,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;
}
if (_autoRotatingShop && _rideConstructionState == RIDE_CONSTRUCTION_STATE_PLACE
@ -3858,7 +3855,10 @@ void ride_construction_tooldown_construct(ScreenCoordsXY screenCoords)
return;
}
for (int32_t zAttempts = 41; zAttempts >= 0; zAttempts--)
// search for appropriate z value, up to max ride height (2^12 - 16)
int numAttempts = (z <= 2032 ? (2032 - z) / 8 + 1 : 2);
for (int32_t zAttempts = numAttempts; zAttempts > 0; zAttempts--)
{
_rideConstructionState = RIDE_CONSTRUCTION_STATE_FRONT;
_currentTrackBegin.x = mapCoords.x;
@ -3881,7 +3881,8 @@ void ride_construction_tooldown_construct(ScreenCoordsXY screenCoords)
z -= 8;
if (errorText == STR_NOT_ENOUGH_CASH_REQUIRES || errorText == STR_CAN_ONLY_BUILD_THIS_UNDERWATER
|| errorText == STR_CAN_ONLY_BUILD_THIS_ON_WATER || errorText == STR_CAN_ONLY_BUILD_THIS_ABOVE_GROUND
|| errorText == STR_TOO_HIGH_FOR_SUPPORTS || zAttempts == 0 || z < 0)
|| errorText == STR_TOO_HIGH_FOR_SUPPORTS || errorText == STR_TOO_HIGH
|| errorText == STR_LOCAL_AUTHORITY_WONT_ALLOW_CONSTRUCTION_ABOVE_TREE_HEIGHT || zAttempts == 1 || z < 0)
{
int32_t saveTrackDirection = _currentTrackPieceDirection;
int32_t saveCurrentTrackCurve = _currentTrackCurve;
@ -3906,10 +3907,8 @@ void ride_construction_tooldown_construct(ScreenCoordsXY screenCoords)
audio_play_sound(SoundId::Error, 0, state->position.x);
break;
}
else if (zAttempts >= 0)
{
z += 16;
}
z += 16;
}
else
{

View File

@ -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 "15"
#define NETWORK_STREAM_VERSION "16"
#define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION
static Peep* _pickup_peep = nullptr;