From e7b690acac28e2dc1a51c4e3e4d467700cf37f41 Mon Sep 17 00:00:00 2001 From: duncanspumpkin Date: Tue, 16 Feb 2016 18:18:43 +0000 Subject: [PATCH] Fix #2959. Water splash correctly drawn in track preview. Issue was caused by missing code that was used to work out the min z value required to place the ride. Without this the watersplash was placed at an invalid z value. --- src/ride/track.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ride/track.c b/src/ride/track.c index 3c912f103c..5a2ee39cb6 100644 --- a/src/ride/track.c +++ b/src/ride/track.c @@ -1685,6 +1685,7 @@ int track_place_ride(sint16 x, sint16 y, sint16 z, uint8 rideIndex, uint8** trac } if (RCT2_GLOBAL(0x00F440D4, uint8) == 3){ + int temp_z = z - TrackCoordinates[track_type].z_begin; for (const rct_preview_track* trackBlock = TrackBlocks[track_type]; trackBlock->index != 0xFF; trackBlock++){ @@ -1742,11 +1743,10 @@ int track_place_ride(sint16 x, sint16 y, sint16 z, uint8 rideIndex, uint8** trac height = water_height; } } - int temp_z = z + RCT2_GLOBAL(0x00F440D5, sint16); - temp_z -= height; + int height_diff = temp_z + RCT2_GLOBAL(0x00F440D5, sint16) + trackBlock->z - height; - if (temp_z < 0){ - RCT2_GLOBAL(0x00F440D5, sint16) -= temp_z; + if (height_diff < 0){ + RCT2_GLOBAL(0x00F440D5, sint16) -= height_diff; } } }