mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-15 11:03:00 +01:00
Extract maze cost calculation
This commit is contained in:
@@ -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,11 @@ TRACK_PAINT_FUNCTION get_track_paint_function_maze(int32_t trackType)
|
||||
|
||||
return maze_paint_setup;
|
||||
}
|
||||
|
||||
money64 MazeCalculateCost(money32 constructionCost, const Ride& ride)
|
||||
{
|
||||
const auto& ted = GetTrackElementDescriptor(TrackElemType::Maze);
|
||||
money64 price = (ride.GetRideTypeDescriptor().BuildCosts.TrackPrice * ted.PriceModifier) >> 16;
|
||||
|
||||
return constructionCost + price;
|
||||
}
|
||||
|
||||
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);
|
||||
Reference in New Issue
Block a user