Merge pull request #21423 from Gymnasiast/feature/partly-above-ground

Add mechanism to allow building partly underground
This commit is contained in:
Michael Steenbeek 2024-02-20 21:44:46 +01:00 committed by GitHub
commit 724ab47a37
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 21 additions and 13 deletions

View File

@ -4,6 +4,7 @@
- Feature: [#21376] Add option to reload an object (for object developers).
- Improved: [#21356] Resize the title bar when moving between displays with different scaling factors on Windows systems.
- Improved: [#21388] Tooltips will now show even when an error message is present.
- Improved: [#21423] Add mechanism to allow building partly underground.
- Fix: [#18963] Research table in parks from Loopy Landscapes is imported incorrectly.
- Fix: [#20907] RCT1/AA scenarios use the 4-across train for the Inverted Roller Coaster.
- Fix: [#21208] Error message will stay open only for a brief moment when the game has been running a while.

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

@ -46,7 +46,7 @@ using namespace OpenRCT2;
// It is used for making sure only compatible builds get connected, even within
// single OpenRCT2 version.
#define NETWORK_STREAM_VERSION "0"
#define NETWORK_STREAM_VERSION "1"
#define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION

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,
@ -6156,8 +6156,8 @@ static constexpr uint16_t TrackFlags[] = {
/* TrackElemType::RightFlyerCorkscrewDown */ TRACK_ELEM_FLAG_DOWN | TRACK_ELEM_FLAG_INVERSION_TO_NORMAL,
/* TrackElemType::HeartLineTransferUp */ 0,
/* TrackElemType::HeartLineTransferDown */ 0,
/* TrackElemType::LeftHeartLineRoll */ TRACK_ELEM_FLAG_NORMAL_TO_INVERSION | TRACK_ELEM_FLAG_INVERSION_TO_NORMAL,
/* TrackElemType::RightHeartLineRoll */ TRACK_ELEM_FLAG_NORMAL_TO_INVERSION | TRACK_ELEM_FLAG_INVERSION_TO_NORMAL,
/* TrackElemType::LeftHeartLineRoll */ TRACK_ELEM_FLAG_NORMAL_TO_INVERSION | TRACK_ELEM_FLAG_INVERSION_TO_NORMAL | TRACK_ELEM_FLAG_CAN_BE_PARTLY_UNDERGROUND,
/* TrackElemType::RightHeartLineRoll */ TRACK_ELEM_FLAG_NORMAL_TO_INVERSION | TRACK_ELEM_FLAG_INVERSION_TO_NORMAL | TRACK_ELEM_FLAG_CAN_BE_PARTLY_UNDERGROUND,
/* TrackElemType::MinigolfHoleA */ TRACK_ELEM_FLAG_IS_GOLF_HOLE,
/* TrackElemType::MinigolfHoleB */ TRACK_ELEM_FLAG_IS_GOLF_HOLE,
/* TrackElemType::MinigolfHoleC */ TRACK_ELEM_FLAG_IS_GOLF_HOLE,

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;