From df5670e09793337f995d5e27258904fe46c631f6 Mon Sep 17 00:00:00 2001 From: Josue Acevedo Date: Thu, 3 Mar 2016 14:57:44 -0600 Subject: [PATCH 1/3] Fix a miscalculation on the track cost (Fixes #3074) --- src/ride/track.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/ride/track.c b/src/ride/track.c index 89f2c4a58b..5139be89d2 100644 --- a/src/ride/track.c +++ b/src/ride/track.c @@ -4575,6 +4575,9 @@ static money32 track_place(int rideIndex, int type, int originX, int originY, in if (!gCheatsDisableClearanceChecks || flags & GAME_COMMAND_FLAG_GHOST){ if (!map_can_construct_with_clear_at(x, y, baseZ, clearanceZ, &map_place_non_scenery_clear_func, bl, flags, &cost)) return MONEY32_UNDEFINED; + else + //"map_place_non_scenery_clear_func" multiply the value of "cost" with 10. The value "cost" is needed without the multiplication. + cost = cost / 10; } //6c53dc @@ -4719,7 +4722,8 @@ static money32 track_place(int rideIndex, int type, int originX, int originY, in support_height = 10; } - cost += (support_height / 2) * RCT2_ADDRESS(0x0097DD7A, uint16)[ride->type * 2]; + cost += ((support_height / 2) * RCT2_ADDRESS(0x0097DD7A, uint16)[ride->type * 2]) / 2; + //6c56d3 if (!(flags & GAME_COMMAND_FLAG_APPLY)) @@ -4864,7 +4868,7 @@ static money32 track_place(int rideIndex, int type, int originX, int originY, in RCT2_ADDRESS(0x0099DA34, money32)[type]; price >>= 16; - price = ((cost + price) / 2) * 10; + price = (cost + (price / 2)) * 10; if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY) { return 0; From ff87b90b8f9bb71f7251ab915c786f9966cc21a1 Mon Sep 17 00:00:00 2001 From: Josue Acevedo Date: Thu, 3 Mar 2016 17:40:44 -0600 Subject: [PATCH 2/3] Make code more clean. Removed an unnecessary "else" code and a unnecessary division with the variable cost. --- src/ride/track.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/ride/track.c b/src/ride/track.c index 5139be89d2..4140d92667 100644 --- a/src/ride/track.c +++ b/src/ride/track.c @@ -4575,9 +4575,6 @@ static money32 track_place(int rideIndex, int type, int originX, int originY, in if (!gCheatsDisableClearanceChecks || flags & GAME_COMMAND_FLAG_GHOST){ if (!map_can_construct_with_clear_at(x, y, baseZ, clearanceZ, &map_place_non_scenery_clear_func, bl, flags, &cost)) return MONEY32_UNDEFINED; - else - //"map_place_non_scenery_clear_func" multiply the value of "cost" with 10. The value "cost" is needed without the multiplication. - cost = cost / 10; } //6c53dc @@ -4722,7 +4719,7 @@ static money32 track_place(int rideIndex, int type, int originX, int originY, in support_height = 10; } - cost += ((support_height / 2) * RCT2_ADDRESS(0x0097DD7A, uint16)[ride->type * 2]) / 2; + cost += (((support_height / 2) * RCT2_ADDRESS(0x0097DD7A, uint16)[ride->type * 2]) / 2) * 10; //6c56d3 @@ -4868,7 +4865,7 @@ static money32 track_place(int rideIndex, int type, int originX, int originY, in RCT2_ADDRESS(0x0099DA34, money32)[type]; price >>= 16; - price = (cost + (price / 2)) * 10; + price = cost + ((price / 2) * 10); if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_FLAGS, uint32) & PARK_FLAGS_NO_MONEY) { return 0; From cf8bb1971ce9aa36d0a84c7664972e3434c1c870 Mon Sep 17 00:00:00 2001 From: Josue Acevedo Date: Thu, 3 Mar 2016 23:13:15 -0600 Subject: [PATCH 3/3] add myself to contributors [ci skip] --- contributors.md | 1 + 1 file changed, 1 insertion(+) diff --git a/contributors.md b/contributors.md index eec496cf28..a1a4b8bf29 100644 --- a/contributors.md +++ b/contributors.md @@ -59,6 +59,7 @@ Includes all git commit authors. Aliases are GitHub user names. * Lucas Riutzel (jackinloadup) * Youngjae Yu (YJSoft) * Chanwoong Kim (kexplo) +* Josué Acevedo (Wirlie) ## Toolchain * (Balletie) - OSX