mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-24 00:03:11 +01:00
Create Ride::ChangeStatusGetStartElement()
Co-authored-by: spacek531 <spacek531@users.noreply.github.com>
This commit is contained in:
@@ -3883,7 +3883,7 @@ TrackElement* Ride::GetOriginElement(StationIndex stationIndex) const
|
||||
|
||||
ResultWithMessage Ride::Test(RideStatus newStatus, bool isApplying)
|
||||
{
|
||||
CoordsXYE trackElement, problematicTrackElement = {};
|
||||
CoordsXYE problematicTrackElement = {};
|
||||
|
||||
if (type == RIDE_TYPE_NULL)
|
||||
{
|
||||
@@ -3913,17 +3913,11 @@ ResultWithMessage Ride::Test(RideStatus newStatus, bool isApplying)
|
||||
}
|
||||
}
|
||||
|
||||
// z = ride->stations[i].GetBaseZ();
|
||||
auto startLoc = GetStation(stationIndex).Start;
|
||||
trackElement.x = startLoc.x;
|
||||
trackElement.y = startLoc.y;
|
||||
trackElement.element = reinterpret_cast<TileElement*>(GetOriginElement(stationIndex));
|
||||
if (trackElement.element == nullptr)
|
||||
CoordsXYE trackElement = {};
|
||||
message = ChangeStatusGetStartElement(stationIndex, trackElement);
|
||||
if (!message.Successful)
|
||||
{
|
||||
// Maze is strange, station start is 0... investigation required
|
||||
const auto& rtd = GetRideTypeDescriptor();
|
||||
if (!rtd.HasFlag(RIDE_TYPE_FLAG_IS_MAZE))
|
||||
return { false };
|
||||
return message;
|
||||
}
|
||||
|
||||
if (mode == RideMode::ContinuousCircuit || IsBlockSectioned())
|
||||
@@ -3949,8 +3943,6 @@ ResultWithMessage Ride::Test(RideStatus newStatus, bool isApplying)
|
||||
*/
|
||||
ResultWithMessage Ride::Open(bool isApplying)
|
||||
{
|
||||
CoordsXYE trackElement = {};
|
||||
|
||||
// Check to see if construction tool is in use. If it is close the construction window
|
||||
// to set the track to its final state and clean up ghosts.
|
||||
// We can't just call close as it would cause a stack overflow during shop creation
|
||||
@@ -3981,17 +3973,11 @@ ResultWithMessage Ride::Open(bool isApplying)
|
||||
lifecycle_flags |= RIDE_LIFECYCLE_EVER_BEEN_OPENED;
|
||||
}
|
||||
|
||||
// z = ride->stations[i].GetBaseZ();
|
||||
auto startLoc = GetStation(stationIndex).Start;
|
||||
trackElement.x = startLoc.x;
|
||||
trackElement.y = startLoc.y;
|
||||
trackElement.element = reinterpret_cast<TileElement*>(GetOriginElement(stationIndex));
|
||||
if (trackElement.element == nullptr)
|
||||
CoordsXYE trackElement = {};
|
||||
message = ChangeStatusGetStartElement(stationIndex, trackElement);
|
||||
if (!message.Successful)
|
||||
{
|
||||
// Maze is strange, station start is 0... investigation required
|
||||
const auto& rtd = GetRideTypeDescriptor();
|
||||
if (!rtd.HasFlag(RIDE_TYPE_FLAG_IS_MAZE))
|
||||
return { false };
|
||||
return message;
|
||||
}
|
||||
|
||||
message = ChangeStatusCheckCompleteCircuit(trackElement);
|
||||
@@ -5803,6 +5789,23 @@ ResultWithMessage Ride::ChangeStatusDoStationChecks(StationIndex& stationIndex)
|
||||
return { true };
|
||||
}
|
||||
|
||||
ResultWithMessage Ride::ChangeStatusGetStartElement(StationIndex stationIndex, CoordsXYE& trackElement)
|
||||
{
|
||||
auto startLoc = GetStation(stationIndex).Start;
|
||||
trackElement.x = startLoc.x;
|
||||
trackElement.y = startLoc.y;
|
||||
trackElement.element = reinterpret_cast<TileElement*>(GetOriginElement(stationIndex));
|
||||
if (trackElement.element == nullptr)
|
||||
{
|
||||
// Maze is strange, station start is 0... investigation required
|
||||
const auto& rtd = GetRideTypeDescriptor();
|
||||
if (!rtd.HasFlag(RIDE_TYPE_FLAG_IS_MAZE))
|
||||
return { false };
|
||||
}
|
||||
|
||||
return { true };
|
||||
}
|
||||
|
||||
ResultWithMessage Ride::ChangeStatusCheckCompleteCircuit(const CoordsXYE& trackElement)
|
||||
{
|
||||
CoordsXYE problematicTrackElement = {};
|
||||
|
||||
@@ -310,6 +310,7 @@ private:
|
||||
void ConstructMissingEntranceOrExit() const;
|
||||
|
||||
ResultWithMessage ChangeStatusDoStationChecks(StationIndex& stationIndex);
|
||||
ResultWithMessage ChangeStatusGetStartElement(StationIndex stationIndex, CoordsXYE& trackElement);
|
||||
ResultWithMessage ChangeStatusCheckCompleteCircuit(const CoordsXYE& trackElement);
|
||||
ResultWithMessage ChangeStatusCheckTrackValidity(const CoordsXYE& trackElement);
|
||||
ResultWithMessage ChangeStatusCreateVehicles(bool isApplying, const CoordsXYE& trackElement);
|
||||
|
||||
Reference in New Issue
Block a user