From f7c769603b448ab7cc43669295a58934ab546a6e Mon Sep 17 00:00:00 2001 From: Rik Smeets <30838294+rik-smeets@users.noreply.github.com> Date: Mon, 22 Aug 2022 18:51:16 +0200 Subject: [PATCH] Close #9104: Calculate maze support costs --- distribution/changelog.txt | 1 + src/openrct2/network/NetworkBase.cpp | 2 +- src/openrct2/ride/gentle/Maze.cpp | 8 ++++++-- src/openrct2/ride/gentle/Maze.h | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/distribution/changelog.txt b/distribution/changelog.txt index 18d98f88c9..ae255580ed 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -10,6 +10,7 @@ - Improved: [#15358] Park and scenario names can now contain up to 128 characters. - Improved: [#16840] Add support for rectangular heightmaps. - Improved: [#17575] You can now search for Authors in Object Selection. +- Change: [#9104] Calculate maze support costs. - Change: [#17319] Giant screenshots are now cropped to the horizontal view-clipping selection. - Change: [#17499] Update error text when using vehicle incompatible with TD6 and add error when using incompatible track elements. - Change: [#17655] Lower default price for the Crooked House. diff --git a/src/openrct2/network/NetworkBase.cpp b/src/openrct2/network/NetworkBase.cpp index be3784cf4c..ffa0abcf1d 100644 --- a/src/openrct2/network/NetworkBase.cpp +++ b/src/openrct2/network/NetworkBase.cpp @@ -42,7 +42,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 "7" +#define NETWORK_STREAM_VERSION "8" #define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION static Peep* _pickup_peep = nullptr; diff --git a/src/openrct2/ride/gentle/Maze.cpp b/src/openrct2/ride/gentle/Maze.cpp index d9bbd86fe8..56ee63459c 100644 --- a/src/openrct2/ride/gentle/Maze.cpp +++ b/src/openrct2/ride/gentle/Maze.cpp @@ -197,10 +197,14 @@ TRACK_PAINT_FUNCTION get_track_paint_function_maze(int32_t trackType) return maze_paint_setup; } -money64 MazeCalculateCost(money32 constructionCost, const Ride& ride) +money64 MazeCalculateCost(money32 constructionCost, const Ride& ride, const CoordsXYZ& _loc) { const auto& ted = GetTrackElementDescriptor(TrackElemType::Maze); money64 price = (ride.GetRideTypeDescriptor().BuildCosts.TrackPrice * ted.PriceModifier) >> 16; - return constructionCost + price; + auto surfaceElement = map_get_surface_element_at(_loc); + auto heightDifference = (_loc.z - surfaceElement->GetBaseZ()) / COORDS_Z_PER_TINY_Z; + money64 supportCost = heightDifference * ride.GetRideTypeDescriptor().BuildCosts.SupportPrice; + + return constructionCost + price + supportCost; } diff --git a/src/openrct2/ride/gentle/Maze.h b/src/openrct2/ride/gentle/Maze.h index e6a882337f..8a13c58f42 100644 --- a/src/openrct2/ride/gentle/Maze.h +++ b/src/openrct2/ride/gentle/Maze.h @@ -11,4 +11,4 @@ #include "../RideData.h" -money64 MazeCalculateCost(money32 constructionCost, const Ride& ride); +money64 MazeCalculateCost(money32 constructionCost, const Ride& ride, const CoordsXYZ& _loc);