Part of #13874: TrackSequenceProperties, Pricing and MirrorMap renamed

This commit is contained in:
frutiemax committed 2021-08-29 10:45:17 -04:00
1 parent b3744f129f
commit 450bf61ee4
15 files changed
+46 -46

No files matched your search

+1 -1
View File
@@ -946,7 +946,7 @@ static void window_new_ride_paint_ride_information(
int32_t startPieceId = GetRideTypeDescriptor(item.Type).StartTrackPiece;
money64 price = GetRideTypeDescriptor(item.Type).BuildCosts.TrackPrice;
const auto& ted = GetTrackElementDescriptor(startPieceId);
price *= ted.Pricing;
price *= ted.Price;
price = (price >> 17) * 10 * GetRideTypeDescriptor(item.Type).BuildCosts.PriceEstimateMultiplier;
//
+1 -1
View File
@@ -1370,7 +1370,7 @@ rct_window* window_ride_open_track(TileElement* tileElement)
auto trackElement = tileElement->AsTrack();
auto trackType = trackElement->GetTrackType();
const auto& ted = GetTrackElementDescriptor(trackType);
if (ted.TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN)
if (ted.SequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN)
{
auto stationIndex = trackElement->GetStationIndex();
return window_ride_open_station(ride, stationIndex);
+2 -2
View File
@@ -574,8 +574,8 @@ static void window_track_place_draw_mini_preview_track(
auto bits = trackBlock->var_08.Rotate(curTrackRotation & 3).GetBaseQuarterOccupied();
// Station track is a lighter colour
uint8_t colour = (ted.TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN) ? _PaletteIndexColourStation
: _PaletteIndexColourTrack;
uint8_t colour = (ted.SequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN) ? _PaletteIndexColourStation
: _PaletteIndexColourTrack;
for (int32_t i = 0; i < 4; i++)
{
@@ -116,7 +116,7 @@ GameActions::Result::Ptr MazePlaceTrackAction::Query() const
}
const auto& ted = GetTrackElementDescriptor(TrackElemType::Maze);
money32 price = (((ride->GetRideTypeDescriptor().BuildCosts.TrackPrice * ted.Pricing) >> 16));
money32 price = (((ride->GetRideTypeDescriptor().BuildCosts.TrackPrice * ted.Price) >> 16));
res->Cost = canBuild->Cost + price / 2 * 10;
return res;
@@ -158,7 +158,7 @@ GameActions::Result::Ptr MazePlaceTrackAction::Execute() const
}
const auto& ted = GetTrackElementDescriptor(TrackElemType::Maze);
money32 price = (((ride->GetRideTypeDescriptor().BuildCosts.TrackPrice * ted.Pricing) >> 16));
money32 price = (((ride->GetRideTypeDescriptor().BuildCosts.TrackPrice * ted.Price) >> 16));
res->Cost = canBuild->Cost + price / 2 * 10;
auto startLoc = _loc.ToTileStart();
+2 -2
View File
@@ -137,7 +137,7 @@ GameActions::Result::Ptr MazeSetTrackAction::Query() const
}
const auto& ted = GetTrackElementDescriptor(TrackElemType::Maze);
money32 price = (((ride->GetRideTypeDescriptor().BuildCosts.TrackPrice * ted.Pricing) >> 16));
money32 price = (((ride->GetRideTypeDescriptor().BuildCosts.TrackPrice * ted.Price) >> 16));
res->Cost = price / 2 * 10;
return res;
@@ -173,7 +173,7 @@ GameActions::Result::Ptr MazeSetTrackAction::Execute() const
if (tileElement == nullptr)
{
const auto& ted = GetTrackElementDescriptor(TrackElemType::Maze);
money32 price = (((ride->GetRideTypeDescriptor().BuildCosts.TrackPrice * ted.Pricing) >> 16));
money32 price = (((ride->GetRideTypeDescriptor().BuildCosts.TrackPrice * ted.Price) >> 16));
res->Cost = price / 2 * 10;
auto startLoc = _loc.ToTileStart();
+5 -5
View File
@@ -318,7 +318,7 @@ GameActions::Result::Ptr TrackPlaceAction::Query() const
}
}
int32_t entranceDirections = ted.TrackSequenceProperties[0];
int32_t entranceDirections = ted.SequenceProperties[0];
if ((entranceDirections & TRACK_SEQUENCE_FLAG_ORIGIN) && trackBlock->index == 0)
{
if (!track_add_station_element({ mapLoc, baseZ, _origin.direction }, _rideIndex, 0, _fromTrackDesign))
@@ -367,7 +367,7 @@ GameActions::Result::Ptr TrackPlaceAction::Query() const
}
money32 price = ride->GetRideTypeDescriptor().BuildCosts.TrackPrice;
price *= ted.Pricing;
price *= ted.Price;
price >>= 16;
res->Cost = cost + ((price / 2) * 10);
@@ -538,7 +538,7 @@ GameActions::Result::Ptr TrackPlaceAction::Execute() const
{
if (!(GetFlags() & GAME_COMMAND_FLAG_NO_SPEND))
{
entranceDirections = ted.TrackSequenceProperties[0];
entranceDirections = ted.SequenceProperties[0];
}
}
@@ -597,7 +597,7 @@ GameActions::Result::Ptr TrackPlaceAction::Execute() const
}
trackElement->SetColourScheme(_colour);
entranceDirections = ted.TrackSequenceProperties[0];
entranceDirections = ted.SequenceProperties[0];
if (entranceDirections & TRACK_SEQUENCE_FLAG_CONNECTS_TO_PATH)
{
uint8_t availableDirections = entranceDirections & 0x0F;
@@ -653,7 +653,7 @@ GameActions::Result::Ptr TrackPlaceAction::Execute() const
}
money32 price = ride->GetRideTypeDescriptor().BuildCosts.TrackPrice;
price *= ted.Pricing;
price *= ted.Price;
price >>= 16;
res->Cost = cost + ((price / 2) * 10);
+4 -4
View File
@@ -203,7 +203,7 @@ GameActions::Result::Ptr TrackRemoveAction::Query() const
return MakeResult(GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS);
}
int32_t entranceDirections = ted.TrackSequenceProperties[0];
int32_t entranceDirections = ted.SequenceProperties[0];
if (entranceDirections & TRACK_SEQUENCE_FLAG_ORIGIN && (tileElement->AsTrack()->GetSequenceIndex() == 0))
{
if (!track_remove_station_element({ mapLoc, _origin.direction }, rideIndex, 0))
@@ -229,7 +229,7 @@ GameActions::Result::Ptr TrackRemoveAction::Query() const
}
money32 price = ride->GetRideTypeDescriptor().BuildCosts.TrackPrice;
price *= ted.Pricing;
price *= ted.Price;
price >>= 16;
price = (price + cost) / 2;
if (ride->lifecycle_flags & RIDE_LIFECYCLE_EVER_BEEN_OPENED)
@@ -378,7 +378,7 @@ GameActions::Result::Ptr TrackRemoveAction::Execute() const
return MakeResult(GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_REMOVE_THIS);
}
int32_t entranceDirections = ted.TrackSequenceProperties[0];
int32_t entranceDirections = ted.SequenceProperties[0];
if (entranceDirections & TRACK_SEQUENCE_FLAG_ORIGIN && (tileElement->AsTrack()->GetSequenceIndex() == 0))
{
if (!track_remove_station_element({ mapLoc, _origin.direction }, rideIndex, 0))
@@ -477,7 +477,7 @@ GameActions::Result::Ptr TrackRemoveAction::Execute() const
}
money32 price = ride->GetRideTypeDescriptor().BuildCosts.TrackPrice;
price *= ted.Pricing;
price *= ted.Price;
price >>= 16;
price = (price + cost) / 2;
if (ride->lifecycle_flags & RIDE_LIFECYCLE_EVER_BEEN_OPENED)
+1 -1
View File
@@ -441,7 +441,7 @@ bool WallPlaceAction::WallCheckObstructionWithTrack(
int32_t z;
if (sequence == 0)
{
if (ted.TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_DISALLOW_DOORS)
if (ted.SequenceProperties[0] & TRACK_SEQUENCE_FLAG_DISALLOW_DOORS)
{
return false;
}
+8 -8
View File
@@ -414,7 +414,7 @@ bool ride_try_get_origin_element(const Ride* ride, CoordsXYE* output)
bool specialTrackPiece
= (it.element->AsTrack()->GetTrackType() != TrackElemType::BeginStation
&& it.element->AsTrack()->GetTrackType() != TrackElemType::MiddleStation
&& (ted.TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN));
&& (ted.SequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN));
// Set result tile to this track piece if first found track or a ???
if (resultTileElement == nullptr || specialTrackPiece)
@@ -2230,7 +2230,7 @@ static void ride_shop_connected(Ride* ride)
}
const auto& ted = GetTrackElementDescriptor(track_type);
uint8_t entrance_directions = ted.TrackSequenceProperties[0] & 0xF;
uint8_t entrance_directions = ted.SequenceProperties[0] & 0xF;
uint8_t tile_direction = trackElement->GetDirection();
entrance_directions = rol4(entrance_directions, tile_direction);
@@ -2775,7 +2775,7 @@ static int32_t ride_check_station_length(CoordsXYE* input, CoordsXYE* output)
do
{
const auto& ted = GetTrackElementDescriptor(output->element->AsTrack()->GetTrackType());
if (ted.TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN)
if (ted.SequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN)
{
num_station_elements++;
last_good_station = *output;
@@ -2823,7 +2823,7 @@ static bool ride_check_start_and_end_is_station(CoordsXYE* input)
track_get_back(input, &trackBack);
auto trackType = trackBack.element->AsTrack()->GetTrackType();
const auto* ted = &GetTrackElementDescriptor(trackType);
if (!(ted->TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN))
if (!(ted->SequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN))
{
return false;
}
@@ -2833,7 +2833,7 @@ static bool ride_check_start_and_end_is_station(CoordsXYE* input)
track_get_front(input, &trackFront);
trackType = trackFront.element->AsTrack()->GetTrackType();
ted = &GetTrackElementDescriptor(trackType);
if (!(ted->TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN))
if (!(ted->SequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN))
{
return false;
}
@@ -3545,7 +3545,7 @@ static bool ride_initialise_cable_lift_track(Ride* ride, bool isApplying)
continue;
const auto& ted = GetTrackElementDescriptor(tileElement->AsTrack()->GetTrackType());
if (!(ted.TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN))
if (!(ted.SequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN))
{
continue;
}
@@ -3778,7 +3778,7 @@ TrackElement* Ride::GetOriginElement(StationIndex stationIndex) const
auto* trackElement = tileElement->AsTrack();
const auto& ted = GetTrackElementDescriptor(trackElement->GetTrackType());
if (!(ted.TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN))
if (!(ted.SequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN))
continue;
if (trackElement->GetRideIndex() == id)
@@ -4885,7 +4885,7 @@ static int32_t ride_get_track_length(Ride* ride)
trackType = tileElement->AsTrack()->GetTrackType();
const auto& ted = GetTrackElementDescriptor(trackType);
if (!(ted.TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN))
if (!(ted.SequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN))
continue;
if (tileElement->GetBaseZ() != trackStart.z)
+5 -5
View File
@@ -1255,7 +1255,7 @@ CoordsXYZD ride_get_entrance_or_exit_position_from_screen_position(const ScreenC
if (info.Element->AsTrack()->GetRideIndex() == gRideEntranceExitPlaceRideIndex)
{
const auto& ted = GetTrackElementDescriptor(info.Element->AsTrack()->GetTrackType());
if (ted.TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN)
if (ted.SequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN)
{
if (info.Element->AsTrack()->GetTrackType() == TrackElemType::Maze)
{
@@ -1346,7 +1346,7 @@ CoordsXYZD ride_get_entrance_or_exit_position_from_screen_position(const ScreenC
int32_t eax = (entranceExitCoords.direction + 2 - tileElement->GetDirection())
& TILE_ELEMENT_DIRECTION_MASK;
const auto& ted = GetTrackElementDescriptor(tileElement->AsTrack()->GetTrackType());
if (ted.TrackSequenceProperties[tileElement->AsTrack()->GetSequenceIndex()] & (1 << eax))
if (ted.SequenceProperties[tileElement->AsTrack()->GetSequenceIndex()] & (1 << eax))
{
entranceExitCoords.direction = direction_reverse(entranceExitCoords.direction);
gRideEntranceExitPlaceDirection = entranceExitCoords.direction;
@@ -1476,7 +1476,7 @@ void sub_6CB945(Ride* ride)
continue;
ted = &GetTrackElementDescriptor(tileElement->AsTrack()->GetTrackType());
if (!(ted->TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN))
if (!(ted->SequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN))
continue;
trackFound = true;
@@ -1521,7 +1521,7 @@ void sub_6CB945(Ride* ride)
continue;
ted = &GetTrackElementDescriptor(tileElement->AsTrack()->GetTrackType());
if (!(ted->TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN))
if (!(ted->SequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN))
continue;
trackFound = true;
@@ -1617,7 +1617,7 @@ void sub_6CB945(Ride* ride)
Direction direction = (tileElement->GetDirection() - direction_reverse(trackElement->GetDirection())) & 3;
ted = &GetTrackElementDescriptor(trackType);
if (!(ted->TrackSequenceProperties[trackSequence] & (1 << direction)))
if (!(ted->SequenceProperties[trackSequence] & (1 << direction)))
{
continue;
}
+3 -3
View File
@@ -5148,14 +5148,14 @@ namespace OpenRCT2
desc.CurveChain = gTrackCurveChain[i];
desc.Flags = TrackFlags[i];
desc.HeightMarkerPositions = TrackHeightMarkerPositions[i];
desc.MirrorMap = TrackElementMirrorMap[i];
desc.MirrorElement = TrackElementMirrorMap[i];
desc.PieceLength = TrackPieceLengths[i];
desc.Pricing = TrackPricing[i];
desc.Price = TrackPricing[i];
for (uint8_t j = 0; j < MaxSequencesPerPiece; j++)
{
desc.SequenceElementAllowedWallEdges[j] = TrackSequenceElementAllowedWallEdges[i][j];
desc.TrackSequenceProperties[j] = TrackSequenceProperties[i][j];
desc.SequenceProperties[j] = TrackSequenceProperties[i][j];
}
_trackElementDescriptors.push_back(desc);
}
+3 -3
View File
@@ -63,13 +63,13 @@ struct TrackElementDescriptor
uint8_t PieceLength;
track_curve_chain CurveChain;
track_type_t AlternativeType;
money32 Pricing;
track_type_t MirrorMap;
money32 Price;
track_type_t MirrorElement;
uint32_t HeightMarkerPositions;
uint16_t Flags;
std::array<uint8_t, MaxSequencesPerPiece> SequenceElementAllowedWallEdges;
std::array<uint8_t, MaxSequencesPerPiece> TrackSequenceProperties;
std::array<uint8_t, MaxSequencesPerPiece> SequenceProperties;
};
namespace OpenRCT2
+1 -1
View File
@@ -771,7 +771,7 @@ static void track_design_mirror_ride(TrackDesign* td6)
for (auto& track : td6->track_elements)
{
const auto& ted = GetTrackElementDescriptor(track.type);
track.type = ted.MirrorMap;
track.type = ted.MirrorElement;
}
for (auto& entrance : td6->entrance_elements)
+2 -2
View File
@@ -7934,7 +7934,7 @@ void Vehicle::Sub6DBF3E()
auto trackType = GetTrackType();
const auto& ted = GetTrackElementDescriptor(trackType);
if (!(ted.TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN))
if (!(ted.SequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN))
{
return;
}
@@ -9210,7 +9210,7 @@ loc_6DCE02:
{
auto trackType = GetTrackType();
const auto& ted = GetTrackElementDescriptor(trackType);
if (!(ted.TrackSequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN))
if (!(ted.SequenceProperties[0] & TRACK_SEQUENCE_FLAG_ORIGIN))
{
return;
}
+6 -6
View File
@@ -882,14 +882,14 @@ static void loc_6A6D7E(
const auto trackType = tileElement->AsTrack()->GetTrackType();
const uint8_t trackSequence = tileElement->AsTrack()->GetSequenceIndex();
const auto& ted = GetTrackElementDescriptor(trackType);
if (!(ted.TrackSequenceProperties[trackSequence] & TRACK_SEQUENCE_FLAG_CONNECTS_TO_PATH))
if (!(ted.SequenceProperties[trackSequence] & TRACK_SEQUENCE_FLAG_CONNECTS_TO_PATH))
{
return;
}
uint16_t dx = direction_reverse(
(direction - tileElement->GetDirection()) & TILE_ELEMENT_DIRECTION_MASK);
if (!(ted.TrackSequenceProperties[trackSequence] & (1 << dx)))
if (!(ted.SequenceProperties[trackSequence] & (1 << dx)))
{
return;
}
@@ -966,12 +966,12 @@ static void loc_6A6C85(
const auto trackType = tileElementPos.element->AsTrack()->GetTrackType();
const uint8_t trackSequence = tileElementPos.element->AsTrack()->GetSequenceIndex();
const auto& ted = GetTrackElementDescriptor(trackType);
if (!(ted.TrackSequenceProperties[trackSequence] & TRACK_SEQUENCE_FLAG_CONNECTS_TO_PATH))
if (!(ted.SequenceProperties[trackSequence] & TRACK_SEQUENCE_FLAG_CONNECTS_TO_PATH))
{
return;
}
uint16_t dx = (direction - tileElementPos.element->GetDirection()) & TILE_ELEMENT_DIRECTION_MASK;
if (!(ted.TrackSequenceProperties[trackSequence] & (1 << dx)))
if (!(ted.SequenceProperties[trackSequence] & (1 << dx)))
{
return;
}
@@ -2108,10 +2108,10 @@ bool tile_element_wants_path_connection_towards(const TileCoordsXYZD& coords, co
const auto trackType = tileElement->AsTrack()->GetTrackType();
const uint8_t trackSequence = tileElement->AsTrack()->GetSequenceIndex();
const auto& ted = GetTrackElementDescriptor(trackType);
if (ted.TrackSequenceProperties[trackSequence] & TRACK_SEQUENCE_FLAG_CONNECTS_TO_PATH)
if (ted.SequenceProperties[trackSequence] & TRACK_SEQUENCE_FLAG_CONNECTS_TO_PATH)
{
uint16_t dx = ((coords.direction - tileElement->GetDirection()) & TILE_ELEMENT_DIRECTION_MASK);
if (ted.TrackSequenceProperties[trackSequence] & (1 << dx))
if (ted.SequenceProperties[trackSequence] & (1 << dx))
{
// Track element has the flags required for the given direction
return true;