From 534b5e9e0be32891bc7f20f8a39fd4f5126c622c Mon Sep 17 00:00:00 2001 From: Adrian Wielgosik Date: Sun, 22 Feb 2015 00:36:58 +0100 Subject: [PATCH] Fixed ride price approximations being truncated; fixes #850. --- src/ride/track.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ride/track.c b/src/ride/track.c index b17b0e67f5..8b364ff68f 100644 --- a/src/ride/track.c +++ b/src/ride/track.c @@ -742,8 +742,8 @@ void load_track_scenery_objects(){ * the track preview window to place the whole track. * Depending on the value of bl it modifies the function. * bl == 0, Draw outlines on the ground -* bl == 3, Returns the z value of a succesful placement -* bl == 5, Returns cost to create the track. Places the track. (used by the preview) +* bl == 3, Returns the z value of a succesful placement. Only lower 16 bits are the value, the rest may be garbage? +* bl == 5, Returns cost to create the track. All 32 bits are used. Places the track. (used by the preview) * bl == 6, Clear white outlined track. * rct2: 0x006D01B3 */ @@ -758,7 +758,9 @@ int sub_6D01B3(int bl, int x, int y, int z) edi = 0; ebp = 0; RCT2_CALLFUNC_X(0x006D01B3, &eax, &ebx, &ecx, &edx, &esi, &edi, &ebp); - return *((short*)&ebx); + if (bl == 3) + ebx &= 0xFFFF; + return ebx; } /* rct2: 0x006D2189