mirror of
https://github.com/OpenRCT2/OpenRCT2.git
synced 2025-01-22 18:31:59 -05:00
Merge pull request #17736 from rik-smeets/calculate-maze-support-costs
This commit is contained in:
commit
8ae01beeb1
6 changed files with 40 additions and 12 deletions
|
@ -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.
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "../management/Finance.h"
|
||||
#include "../ride/RideData.h"
|
||||
#include "../ride/TrackData.h"
|
||||
#include "../ride/gentle/Maze.h"
|
||||
#include "../world/ConstructionClearance.h"
|
||||
|
||||
using namespace OpenRCT2::TrackMetaData;
|
||||
|
@ -119,9 +120,7 @@ GameActions::Result MazePlaceTrackAction::Query() const
|
|||
return res;
|
||||
}
|
||||
|
||||
const auto& ted = GetTrackElementDescriptor(TrackElemType::Maze);
|
||||
money64 price = (((ride->GetRideTypeDescriptor().BuildCosts.TrackPrice * ted.PriceModifier) >> 16));
|
||||
res.Cost = canBuild.Cost + price;
|
||||
res.Cost = MazeCalculateCost(canBuild.Cost, *ride, _loc);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
@ -161,9 +160,7 @@ GameActions::Result MazePlaceTrackAction::Execute() const
|
|||
return canBuild;
|
||||
}
|
||||
|
||||
const auto& ted = GetTrackElementDescriptor(TrackElemType::Maze);
|
||||
money64 price = (((ride->GetRideTypeDescriptor().BuildCosts.TrackPrice * ted.PriceModifier) >> 16));
|
||||
res.Cost = canBuild.Cost + price;
|
||||
res.Cost = MazeCalculateCost(canBuild.Cost, *ride, _loc);
|
||||
|
||||
auto startLoc = _loc.ToTileStart();
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "../ride/RideData.h"
|
||||
#include "../ride/Track.h"
|
||||
#include "../ride/TrackData.h"
|
||||
#include "../ride/gentle/Maze.h"
|
||||
#include "../world/ConstructionClearance.h"
|
||||
#include "../world/Footpath.h"
|
||||
#include "../world/Park.h"
|
||||
|
@ -138,9 +139,7 @@ GameActions::Result MazeSetTrackAction::Query() const
|
|||
return res;
|
||||
}
|
||||
|
||||
const auto& ted = GetTrackElementDescriptor(TrackElemType::Maze);
|
||||
money64 price = (((ride->GetRideTypeDescriptor().BuildCosts.TrackPrice * ted.PriceModifier) >> 16));
|
||||
res.Cost = price;
|
||||
res.Cost = MazeCalculateCost(constructResult.Cost, *ride, _loc);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
@ -174,9 +173,7 @@ GameActions::Result MazeSetTrackAction::Execute() const
|
|||
auto tileElement = map_get_track_element_at_of_type_from_ride(_loc, TrackElemType::Maze, _rideIndex);
|
||||
if (tileElement == nullptr)
|
||||
{
|
||||
const auto& ted = GetTrackElementDescriptor(TrackElemType::Maze);
|
||||
money64 price = (((ride->GetRideTypeDescriptor().BuildCosts.TrackPrice * ted.PriceModifier) >> 16));
|
||||
res.Cost = price;
|
||||
res.Cost = MazeCalculateCost(0, *ride, _loc);
|
||||
|
||||
auto startLoc = _loc.ToTileStart();
|
||||
|
||||
|
|
|
@ -391,6 +391,7 @@
|
|||
<ClInclude Include="ride\coaster\meta\WaterCoaster.h" />
|
||||
<ClInclude Include="ride\coaster\meta\WoodenRollerCoaster.h" />
|
||||
<ClInclude Include="ride\coaster\meta\WoodenWildMouse.h" />
|
||||
<ClInclude Include="ride\gentle\Maze.h" />
|
||||
<ClInclude Include="ride\gentle\meta\CarRide.h" />
|
||||
<ClInclude Include="ride\gentle\meta\Circus.h" />
|
||||
<ClInclude Include="ride\gentle\meta\CrookedHouse.h" />
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "Maze.h"
|
||||
|
||||
#include "../../core/Numerics.hpp"
|
||||
#include "../../interface/Viewport.h"
|
||||
#include "../../paint/Paint.h"
|
||||
|
@ -15,9 +17,13 @@
|
|||
#include "../../sprites.h"
|
||||
#include "../../world/Map.h"
|
||||
#include "../Ride.h"
|
||||
#include "../RideData.h"
|
||||
#include "../Track.h"
|
||||
#include "../TrackData.h"
|
||||
#include "../TrackPaint.h"
|
||||
|
||||
using namespace OpenRCT2::TrackMetaData;
|
||||
|
||||
enum
|
||||
{
|
||||
SPR_MAZE_BASE_HEDGE = 21938,
|
||||
|
@ -190,3 +196,15 @@ TRACK_PAINT_FUNCTION get_track_paint_function_maze(int32_t trackType)
|
|||
|
||||
return maze_paint_setup;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
14
src/openrct2/ride/gentle/Maze.h
Normal file
14
src/openrct2/ride/gentle/Maze.h
Normal file
|
@ -0,0 +1,14 @@
|
|||
/*****************************************************************************
|
||||
* Copyright (c) 2014-2022 OpenRCT2 developers
|
||||
*
|
||||
* For a complete list of all authors, please refer to contributors.md
|
||||
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
|
||||
*
|
||||
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
||||
*****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../RideData.h"
|
||||
|
||||
money64 MazeCalculateCost(money32 constructionCost, const Ride& ride, const CoordsXYZ& _loc);
|
Loading…
Reference in a new issue