1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-27 00:34:46 +01:00

Create flag to allow building track segment partly underground

This commit is contained in:
Gymnasiast
2024-01-30 01:34:00 +01:00
parent d8864e567c
commit 731275613a
4 changed files with 17 additions and 10 deletions

View File

@@ -265,11 +265,14 @@ GameActions::Result TrackPlaceAction::Query() const
const auto clearanceData = canBuild.GetData<ConstructClearResult>();
uint8_t mapGroundFlags = clearanceData.GroundFlags & (ELEMENT_IS_ABOVE_GROUND | ELEMENT_IS_UNDERGROUND);
if (resultData.GroundFlags != 0 && (resultData.GroundFlags & mapGroundFlags) == 0)
if (!(ted.Flags & TRACK_ELEM_FLAG_CAN_BE_PARTLY_UNDERGROUND))
{
return GameActions::Result(
GameActions::Status::Disallowed, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE,
STR_CANT_BUILD_PARTLY_ABOVE_AND_PARTLY_BELOW_GROUND);
if (resultData.GroundFlags != 0 && (resultData.GroundFlags & mapGroundFlags) == 0)
{
return GameActions::Result(
GameActions::Status::Disallowed, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE,
STR_CANT_BUILD_PARTLY_ABOVE_AND_PARTLY_BELOW_GROUND);
}
}
resultData.GroundFlags = mapGroundFlags;
@@ -508,11 +511,14 @@ GameActions::Result TrackPlaceAction::Execute() const
const auto clearanceData = canBuild.GetData<ConstructClearResult>();
uint8_t mapGroundFlags = clearanceData.GroundFlags & (ELEMENT_IS_ABOVE_GROUND | ELEMENT_IS_UNDERGROUND);
if (resultData.GroundFlags != 0 && (resultData.GroundFlags & mapGroundFlags) == 0)
if (!(ted.Flags & TRACK_ELEM_FLAG_CAN_BE_PARTLY_UNDERGROUND))
{
return GameActions::Result(
GameActions::Status::Disallowed, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE,
STR_CANT_BUILD_PARTLY_ABOVE_AND_PARTLY_BELOW_GROUND);
if (resultData.GroundFlags != 0 && (resultData.GroundFlags & mapGroundFlags) == 0)
{
return GameActions::Result(
GameActions::Status::Disallowed, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE,
STR_CANT_BUILD_PARTLY_ABOVE_AND_PARTLY_BELOW_GROUND);
}
}
resultData.GroundFlags = mapGroundFlags;

View File

@@ -259,6 +259,7 @@ enum
TRACK_ELEM_FLAG_CURVE_ALLOWS_LIFT = (1 << 13),
TRACK_ELEM_FLAG_INVERSION_TO_NORMAL = (1 << 14),
TRACK_ELEM_FLAG_BANKED = (1 << 15), // Also set on Spinning Tunnel and Log Flume reverser, probably to save a flag.
TRACK_ELEM_FLAG_CAN_BE_PARTLY_UNDERGROUND = (1 << 16),
};
namespace TrackElemType

View File

@@ -5956,7 +5956,7 @@ static constexpr uint8_t TrackSequenceElementAllowedWallEdges[][MaxSequencesPerP
static_assert(std::size(TrackSequenceElementAllowedWallEdges) == TrackElemType::Count);
/** rct2: 0x0099423C */
static constexpr uint16_t TrackFlags[] = {
static constexpr uint32_t TrackFlags[] = {
/* TrackElemType::Flat */ TRACK_ELEM_FLAG_ALLOW_LIFT_HILL,
/* TrackElemType::EndStation */ 0,
/* TrackElemType::BeginStation */ 0,

View File

@@ -87,7 +87,7 @@ struct TrackElementDescriptor
uint32_t PriceModifier;
track_type_t MirrorElement;
uint32_t HeightMarkerPositions;
uint16_t Flags;
uint32_t Flags;
std::array<uint8_t, MaxSequencesPerPiece> SequenceElementAllowedWallEdges;
std::array<uint8_t, MaxSequencesPerPiece> SequenceProperties;