mirror of https://github.com/OpenRCT2/OpenRCT2.git
Extract maze cost calculation
This commit is contained in:
parent
0ff79d58fe
commit
5c596eae5d
|
@ -11,6 +11,7 @@
|
||||||
#include "../management/Finance.h"
|
#include "../management/Finance.h"
|
||||||
#include "../ride/RideData.h"
|
#include "../ride/RideData.h"
|
||||||
#include "../ride/TrackData.h"
|
#include "../ride/TrackData.h"
|
||||||
|
#include "../ride/gentle/Maze.h"
|
||||||
#include "../world/ConstructionClearance.h"
|
#include "../world/ConstructionClearance.h"
|
||||||
|
|
||||||
using namespace OpenRCT2::TrackMetaData;
|
using namespace OpenRCT2::TrackMetaData;
|
||||||
|
@ -119,9 +120,7 @@ GameActions::Result MazePlaceTrackAction::Query() const
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& ted = GetTrackElementDescriptor(TrackElemType::Maze);
|
res.Cost = MazeCalculateCost(canBuild.Cost, *ride, _loc);
|
||||||
money64 price = (((ride->GetRideTypeDescriptor().BuildCosts.TrackPrice * ted.PriceModifier) >> 16));
|
|
||||||
res.Cost = canBuild.Cost + price;
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -161,9 +160,7 @@ GameActions::Result MazePlaceTrackAction::Execute() const
|
||||||
return canBuild;
|
return canBuild;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& ted = GetTrackElementDescriptor(TrackElemType::Maze);
|
res.Cost = MazeCalculateCost(canBuild.Cost, *ride, _loc);
|
||||||
money64 price = (((ride->GetRideTypeDescriptor().BuildCosts.TrackPrice * ted.PriceModifier) >> 16));
|
|
||||||
res.Cost = canBuild.Cost + price;
|
|
||||||
|
|
||||||
auto startLoc = _loc.ToTileStart();
|
auto startLoc = _loc.ToTileStart();
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#include "../ride/RideData.h"
|
#include "../ride/RideData.h"
|
||||||
#include "../ride/Track.h"
|
#include "../ride/Track.h"
|
||||||
#include "../ride/TrackData.h"
|
#include "../ride/TrackData.h"
|
||||||
|
#include "../ride/gentle/Maze.h"
|
||||||
#include "../world/ConstructionClearance.h"
|
#include "../world/ConstructionClearance.h"
|
||||||
#include "../world/Footpath.h"
|
#include "../world/Footpath.h"
|
||||||
#include "../world/Park.h"
|
#include "../world/Park.h"
|
||||||
|
@ -138,9 +139,7 @@ GameActions::Result MazeSetTrackAction::Query() const
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto& ted = GetTrackElementDescriptor(TrackElemType::Maze);
|
res.Cost = MazeCalculateCost(constructResult.Cost, *ride, _loc);
|
||||||
money64 price = (((ride->GetRideTypeDescriptor().BuildCosts.TrackPrice * ted.PriceModifier) >> 16));
|
|
||||||
res.Cost = price;
|
|
||||||
|
|
||||||
return res;
|
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);
|
auto tileElement = map_get_track_element_at_of_type_from_ride(_loc, TrackElemType::Maze, _rideIndex);
|
||||||
if (tileElement == nullptr)
|
if (tileElement == nullptr)
|
||||||
{
|
{
|
||||||
const auto& ted = GetTrackElementDescriptor(TrackElemType::Maze);
|
res.Cost = MazeCalculateCost(0, *ride, _loc);
|
||||||
money64 price = (((ride->GetRideTypeDescriptor().BuildCosts.TrackPrice * ted.PriceModifier) >> 16));
|
|
||||||
res.Cost = price;
|
|
||||||
|
|
||||||
auto startLoc = _loc.ToTileStart();
|
auto startLoc = _loc.ToTileStart();
|
||||||
|
|
||||||
|
|
|
@ -391,6 +391,7 @@
|
||||||
<ClInclude Include="ride\coaster\meta\WaterCoaster.h" />
|
<ClInclude Include="ride\coaster\meta\WaterCoaster.h" />
|
||||||
<ClInclude Include="ride\coaster\meta\WoodenRollerCoaster.h" />
|
<ClInclude Include="ride\coaster\meta\WoodenRollerCoaster.h" />
|
||||||
<ClInclude Include="ride\coaster\meta\WoodenWildMouse.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\CarRide.h" />
|
||||||
<ClInclude Include="ride\gentle\meta\Circus.h" />
|
<ClInclude Include="ride\gentle\meta\Circus.h" />
|
||||||
<ClInclude Include="ride\gentle\meta\CrookedHouse.h" />
|
<ClInclude Include="ride\gentle\meta\CrookedHouse.h" />
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include "Maze.h"
|
||||||
|
|
||||||
#include "../../core/Numerics.hpp"
|
#include "../../core/Numerics.hpp"
|
||||||
#include "../../interface/Viewport.h"
|
#include "../../interface/Viewport.h"
|
||||||
#include "../../paint/Paint.h"
|
#include "../../paint/Paint.h"
|
||||||
|
@ -15,9 +17,13 @@
|
||||||
#include "../../sprites.h"
|
#include "../../sprites.h"
|
||||||
#include "../../world/Map.h"
|
#include "../../world/Map.h"
|
||||||
#include "../Ride.h"
|
#include "../Ride.h"
|
||||||
|
#include "../RideData.h"
|
||||||
#include "../Track.h"
|
#include "../Track.h"
|
||||||
|
#include "../TrackData.h"
|
||||||
#include "../TrackPaint.h"
|
#include "../TrackPaint.h"
|
||||||
|
|
||||||
|
using namespace OpenRCT2::TrackMetaData;
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
SPR_MAZE_BASE_HEDGE = 21938,
|
SPR_MAZE_BASE_HEDGE = 21938,
|
||||||
|
@ -190,3 +196,11 @@ TRACK_PAINT_FUNCTION get_track_paint_function_maze(int32_t trackType)
|
||||||
|
|
||||||
return maze_paint_setup;
|
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;
|
||||||
|
}
|
||||||
|
|
|
@ -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);
|
Loading…
Reference in New Issue