mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge 37d5cc9ecc
into d58673105d
This commit is contained in:
commit
1d0f4550aa
|
@ -43,6 +43,18 @@ uint16_t TrackRemoveAction::GetActionFlags() const
|
|||
return GameAction::GetActionFlags();
|
||||
}
|
||||
|
||||
int32_t TrackRemoveAction::NormaliseTrackType(int32_t trackType) const
|
||||
{
|
||||
switch (trackType)
|
||||
{
|
||||
case TrackElemType::BeginStation:
|
||||
case TrackElemType::MiddleStation:
|
||||
return TrackElemType::EndStation;
|
||||
}
|
||||
|
||||
return trackType;
|
||||
}
|
||||
|
||||
void TrackRemoveAction::Serialise(DataSerialiser& stream)
|
||||
{
|
||||
GameAction::Serialise(stream);
|
||||
|
@ -59,14 +71,7 @@ GameActions::Result TrackRemoveAction::Query() const
|
|||
res.Expenditure = ExpenditureType::RideConstruction;
|
||||
|
||||
// Stations require some massaging of the track type for comparing
|
||||
auto comparableTrackType = _trackType;
|
||||
switch (_trackType)
|
||||
{
|
||||
case TrackElemType::BeginStation:
|
||||
case TrackElemType::MiddleStation:
|
||||
comparableTrackType = TrackElemType::EndStation;
|
||||
break;
|
||||
}
|
||||
auto comparableTrackType = NormaliseTrackType(_trackType);
|
||||
|
||||
bool found = false;
|
||||
bool isGhost = GetFlags() & GAME_COMMAND_FLAG_GHOST;
|
||||
|
@ -92,14 +97,7 @@ GameActions::Result TrackRemoveAction::Query() const
|
|||
if (tileElement->IsGhost() != isGhost)
|
||||
continue;
|
||||
|
||||
auto tileTrackType = tileElement->AsTrack()->GetTrackType();
|
||||
switch (tileTrackType)
|
||||
{
|
||||
case TrackElemType::BeginStation:
|
||||
case TrackElemType::MiddleStation:
|
||||
tileTrackType = TrackElemType::EndStation;
|
||||
break;
|
||||
}
|
||||
auto tileTrackType = NormaliseTrackType(tileElement->AsTrack()->GetTrackType());
|
||||
|
||||
if (tileTrackType != comparableTrackType)
|
||||
continue;
|
||||
|
@ -266,14 +264,7 @@ GameActions::Result TrackRemoveAction::Execute() const
|
|||
res.Expenditure = ExpenditureType::RideConstruction;
|
||||
|
||||
// Stations require some massaging of the track type for comparing
|
||||
auto comparableTrackType = _trackType;
|
||||
switch (_trackType)
|
||||
{
|
||||
case TrackElemType::BeginStation:
|
||||
case TrackElemType::MiddleStation:
|
||||
comparableTrackType = TrackElemType::EndStation;
|
||||
break;
|
||||
}
|
||||
auto comparableTrackType = NormaliseTrackType(_trackType);
|
||||
|
||||
bool found = false;
|
||||
bool isGhost = GetFlags() & GAME_COMMAND_FLAG_GHOST;
|
||||
|
@ -299,14 +290,7 @@ GameActions::Result TrackRemoveAction::Execute() const
|
|||
if (tileElement->IsGhost() != isGhost)
|
||||
continue;
|
||||
|
||||
auto tileTrackType = tileElement->AsTrack()->GetTrackType();
|
||||
switch (tileTrackType)
|
||||
{
|
||||
case TrackElemType::BeginStation:
|
||||
case TrackElemType::MiddleStation:
|
||||
tileTrackType = TrackElemType::EndStation;
|
||||
break;
|
||||
}
|
||||
auto tileTrackType = NormaliseTrackType(tileElement->AsTrack()->GetTrackType());
|
||||
|
||||
if (tileTrackType != comparableTrackType)
|
||||
continue;
|
||||
|
|
|
@ -26,6 +26,8 @@ public:
|
|||
|
||||
uint16_t GetActionFlags() const override final;
|
||||
|
||||
int32_t NormaliseTrackType(int32_t trackType) const;
|
||||
|
||||
void Serialise(DataSerialiser& stream) override;
|
||||
GameActions::Result Query() const override;
|
||||
GameActions::Result Execute() const override;
|
||||
|
|
Loading…
Reference in New Issue