From e6e0f9755721044ca1ee5314b05799bbce9497dc Mon Sep 17 00:00:00 2001 From: Michael Steenbeek <1478678+Gymnasiast@users.noreply.github.com> Date: Thu, 3 Oct 2024 12:42:53 +0200 Subject: [PATCH] Split off EntranceElement header --- .../interface/ViewportInteraction.cpp | 1 + src/openrct2-ui/interface/ViewportQuery.cpp | 1 + src/openrct2-ui/windows/Map.cpp | 1 + src/openrct2-ui/windows/MazeConstruction.cpp | 1 + src/openrct2-ui/windows/Ride.cpp | 1 + src/openrct2-ui/windows/RideConstruction.cpp | 1 + src/openrct2-ui/windows/TileInspector.cpp | 1 + src/openrct2/EditorObjectSelectionSession.cpp | 1 + .../actions/FootpathLayoutPlaceAction.cpp | 1 + src/openrct2/actions/FootpathPlaceAction.cpp | 1 + src/openrct2/actions/LandSetRightsAction.cpp | 1 + .../actions/ParkEntrancePlaceAction.cpp | 1 + .../actions/ParkEntranceRemoveAction.cpp | 1 + .../actions/RideEntranceExitPlaceAction.cpp | 1 + .../actions/RideEntranceExitRemoveAction.cpp | 1 + src/openrct2/entity/Guest.cpp | 1 + src/openrct2/entity/Peep.cpp | 1 + src/openrct2/entity/Staff.cpp | 1 + src/openrct2/libopenrct2.vcxproj | 1 + .../paint/tile_element/Paint.Entrance.cpp | 1 + src/openrct2/peep/GuestPathfinding.cpp | 1 + src/openrct2/rct1/S4Importer.cpp | 1 + src/openrct2/rct12/ScenarioPatcher.cpp | 1 + src/openrct2/rct2/S6Importer.cpp | 1 + src/openrct2/ride/Ride.cpp | 1 + src/openrct2/ride/RideConstruction.cpp | 1 + src/openrct2/ride/TrackDesign.cpp | 1 + src/openrct2/ride/TrackDesignSave.cpp | 1 + .../bindings/world/ScTileElement.cpp | 1 + src/openrct2/world/ConstructionClearance.cpp | 3 +- src/openrct2/world/Entrance.cpp | 1 + src/openrct2/world/Footpath.cpp | 3 +- src/openrct2/world/Map.cpp | 3 +- src/openrct2/world/MapAnimation.cpp | 1 + src/openrct2/world/Park.cpp | 1 + src/openrct2/world/TileElement.cpp | 11 +++ src/openrct2/world/TileElement.h | 67 +---------------- src/openrct2/world/TileInspector.cpp | 1 + .../world/tile_element/EntranceElement.cpp | 3 +- .../world/tile_element/EntranceElement.h | 75 +++++++++++++++++++ test/tests/TileElements.cpp | 1 + test/tests/TileElementsView.cpp | 1 + 42 files changed, 132 insertions(+), 68 deletions(-) create mode 100644 src/openrct2/world/tile_element/EntranceElement.h diff --git a/src/openrct2-ui/interface/ViewportInteraction.cpp b/src/openrct2-ui/interface/ViewportInteraction.cpp index 6337c700a9..7bab99d682 100644 --- a/src/openrct2-ui/interface/ViewportInteraction.cpp +++ b/src/openrct2-ui/interface/ViewportInteraction.cpp @@ -53,6 +53,7 @@ #include #include #include +#include using namespace OpenRCT2; using namespace OpenRCT2::Ui::Windows; diff --git a/src/openrct2-ui/interface/ViewportQuery.cpp b/src/openrct2-ui/interface/ViewportQuery.cpp index b04bbdf6e6..bd81178ff0 100644 --- a/src/openrct2-ui/interface/ViewportQuery.cpp +++ b/src/openrct2-ui/interface/ViewportQuery.cpp @@ -14,6 +14,7 @@ #include #include #include +#include namespace OpenRCT2::Ui { diff --git a/src/openrct2-ui/windows/Map.cpp b/src/openrct2-ui/windows/Map.cpp index db4acc0421..4d1ba611ff 100644 --- a/src/openrct2-ui/windows/Map.cpp +++ b/src/openrct2-ui/windows/Map.cpp @@ -34,6 +34,7 @@ #include #include #include +#include #include #include diff --git a/src/openrct2-ui/windows/MazeConstruction.cpp b/src/openrct2-ui/windows/MazeConstruction.cpp index 28e23fbc4e..e7bc851276 100644 --- a/src/openrct2-ui/windows/MazeConstruction.cpp +++ b/src/openrct2-ui/windows/MazeConstruction.cpp @@ -26,6 +26,7 @@ #include #include #include +#include namespace OpenRCT2::Ui::Windows { diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index 7a9fd0cbf1..cde7c29a41 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -64,6 +64,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/RideConstruction.cpp b/src/openrct2-ui/windows/RideConstruction.cpp index cd5a86e8b2..b7f53646b6 100644 --- a/src/openrct2-ui/windows/RideConstruction.cpp +++ b/src/openrct2-ui/windows/RideConstruction.cpp @@ -49,6 +49,7 @@ #include #include #include +#include constexpr int8_t kDefaultSpeedIncrement = 2; constexpr int8_t kDefaultMinimumSpeed = 2; diff --git a/src/openrct2-ui/windows/TileInspector.cpp b/src/openrct2-ui/windows/TileInspector.cpp index cf84cf44a7..dba404683d 100644 --- a/src/openrct2-ui/windows/TileInspector.cpp +++ b/src/openrct2-ui/windows/TileInspector.cpp @@ -41,6 +41,7 @@ #include #include #include +#include #include namespace OpenRCT2::Ui::Windows diff --git a/src/openrct2/EditorObjectSelectionSession.cpp b/src/openrct2/EditorObjectSelectionSession.cpp index ba4b925737..814f10e95c 100644 --- a/src/openrct2/EditorObjectSelectionSession.cpp +++ b/src/openrct2/EditorObjectSelectionSession.cpp @@ -30,6 +30,7 @@ #include "windows/Intent.h" #include "world/Footpath.h" #include "world/Scenery.h" +#include "world/tile_element/EntranceElement.h" #include #include diff --git a/src/openrct2/actions/FootpathLayoutPlaceAction.cpp b/src/openrct2/actions/FootpathLayoutPlaceAction.cpp index 5b53183c72..01f4173a28 100644 --- a/src/openrct2/actions/FootpathLayoutPlaceAction.cpp +++ b/src/openrct2/actions/FootpathLayoutPlaceAction.cpp @@ -23,6 +23,7 @@ #include "../world/Park.h" #include "../world/Surface.h" #include "../world/Wall.h" +#include "../world/tile_element/EntranceElement.h" #include "../world/tile_element/Slope.h" using namespace OpenRCT2; diff --git a/src/openrct2/actions/FootpathPlaceAction.cpp b/src/openrct2/actions/FootpathPlaceAction.cpp index bafbf49859..4529e7a491 100644 --- a/src/openrct2/actions/FootpathPlaceAction.cpp +++ b/src/openrct2/actions/FootpathPlaceAction.cpp @@ -29,6 +29,7 @@ #include "../world/Surface.h" #include "../world/TileElementsView.h" #include "../world/Wall.h" +#include "../world/tile_element/EntranceElement.h" #include "../world/tile_element/Slope.h" #include diff --git a/src/openrct2/actions/LandSetRightsAction.cpp b/src/openrct2/actions/LandSetRightsAction.cpp index 9fe1f09555..89c20b04b2 100644 --- a/src/openrct2/actions/LandSetRightsAction.cpp +++ b/src/openrct2/actions/LandSetRightsAction.cpp @@ -25,6 +25,7 @@ #include "../world/Scenery.h" #include "../world/Surface.h" #include "../world/TileElementsView.h" +#include "../world/tile_element/EntranceElement.h" using namespace OpenRCT2; diff --git a/src/openrct2/actions/ParkEntrancePlaceAction.cpp b/src/openrct2/actions/ParkEntrancePlaceAction.cpp index 8ad58ec0c8..d52baca087 100644 --- a/src/openrct2/actions/ParkEntrancePlaceAction.cpp +++ b/src/openrct2/actions/ParkEntrancePlaceAction.cpp @@ -21,6 +21,7 @@ #include "../world/MapAnimation.h" #include "../world/Park.h" #include "../world/Surface.h" +#include "../world/tile_element/EntranceElement.h" using namespace OpenRCT2; diff --git a/src/openrct2/actions/ParkEntranceRemoveAction.cpp b/src/openrct2/actions/ParkEntranceRemoveAction.cpp index e3a167057c..aee81da261 100644 --- a/src/openrct2/actions/ParkEntranceRemoveAction.cpp +++ b/src/openrct2/actions/ParkEntranceRemoveAction.cpp @@ -15,6 +15,7 @@ #include "../management/Finance.h" #include "../world/Entrance.h" #include "../world/Park.h" +#include "../world/tile_element/EntranceElement.h" using namespace OpenRCT2; diff --git a/src/openrct2/actions/RideEntranceExitPlaceAction.cpp b/src/openrct2/actions/RideEntranceExitPlaceAction.cpp index 5633f64ba7..0c36593739 100644 --- a/src/openrct2/actions/RideEntranceExitPlaceAction.cpp +++ b/src/openrct2/actions/RideEntranceExitPlaceAction.cpp @@ -17,6 +17,7 @@ #include "../ride/Station.h" #include "../world/ConstructionClearance.h" #include "../world/MapAnimation.h" +#include "../world/tile_element/EntranceElement.h" using namespace OpenRCT2; diff --git a/src/openrct2/actions/RideEntranceExitRemoveAction.cpp b/src/openrct2/actions/RideEntranceExitRemoveAction.cpp index 7732e8c901..4155301ec4 100644 --- a/src/openrct2/actions/RideEntranceExitRemoveAction.cpp +++ b/src/openrct2/actions/RideEntranceExitRemoveAction.cpp @@ -14,6 +14,7 @@ #include "../ride/Station.h" #include "../world/Entrance.h" #include "../world/TileElementsView.h" +#include "../world/tile_element/EntranceElement.h" using namespace OpenRCT2; diff --git a/src/openrct2/entity/Guest.cpp b/src/openrct2/entity/Guest.cpp index 36a3f94d14..c09f0e2e01 100644 --- a/src/openrct2/entity/Guest.cpp +++ b/src/openrct2/entity/Guest.cpp @@ -60,6 +60,7 @@ #include "../world/Scenery.h" #include "../world/Surface.h" #include "../world/TileElementsView.h" +#include "../world/tile_element/EntranceElement.h" #include "Peep.h" #include "Staff.h" diff --git a/src/openrct2/entity/Peep.cpp b/src/openrct2/entity/Peep.cpp index 77d83bd47c..5c9f354de6 100644 --- a/src/openrct2/entity/Peep.cpp +++ b/src/openrct2/entity/Peep.cpp @@ -56,6 +56,7 @@ #include "../world/Park.h" #include "../world/Scenery.h" #include "../world/Surface.h" +#include "../world/tile_element/EntranceElement.h" #include "PatrolArea.h" #include "Staff.h" diff --git a/src/openrct2/entity/Staff.cpp b/src/openrct2/entity/Staff.cpp index fb88e5f494..b06525ac80 100644 --- a/src/openrct2/entity/Staff.cpp +++ b/src/openrct2/entity/Staff.cpp @@ -43,6 +43,7 @@ #include "../world/Footpath.h" #include "../world/Scenery.h" #include "../world/Surface.h" +#include "../world/tile_element/EntranceElement.h" #include "../world/tile_element/Slope.h" #include "PatrolArea.h" #include "Peep.h" diff --git a/src/openrct2/libopenrct2.vcxproj b/src/openrct2/libopenrct2.vcxproj index 4c0af9968c..f1878287a4 100644 --- a/src/openrct2/libopenrct2.vcxproj +++ b/src/openrct2/libopenrct2.vcxproj @@ -599,6 +599,7 @@ + diff --git a/src/openrct2/paint/tile_element/Paint.Entrance.cpp b/src/openrct2/paint/tile_element/Paint.Entrance.cpp index a5c4e5690a..4968e61b9a 100644 --- a/src/openrct2/paint/tile_element/Paint.Entrance.cpp +++ b/src/openrct2/paint/tile_element/Paint.Entrance.cpp @@ -29,6 +29,7 @@ #include "../../world/Footpath.h" #include "../../world/Park.h" #include "../../world/TileInspector.h" +#include "../../world/tile_element/EntranceElement.h" #include "../support/WoodenSupports.h" #include "Paint.TileElement.h" #include "Segment.h" diff --git a/src/openrct2/peep/GuestPathfinding.cpp b/src/openrct2/peep/GuestPathfinding.cpp index d0cec670cc..5a66ee54d6 100644 --- a/src/openrct2/peep/GuestPathfinding.cpp +++ b/src/openrct2/peep/GuestPathfinding.cpp @@ -22,6 +22,7 @@ #include "../util/Util.h" #include "../world/Entrance.h" #include "../world/Footpath.h" +#include "../world/tile_element/EntranceElement.h" #include #include diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index c70f411dfc..e84ee3ddba 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -72,6 +72,7 @@ #include "../world/Surface.h" #include "../world/TilePointerIndex.hpp" #include "../world/Wall.h" +#include "../world/tile_element/EntranceElement.h" #include "RCT1.h" #include "Tables.h" diff --git a/src/openrct2/rct12/ScenarioPatcher.cpp b/src/openrct2/rct12/ScenarioPatcher.cpp index fd0189d231..c0a5d58623 100644 --- a/src/openrct2/rct12/ScenarioPatcher.cpp +++ b/src/openrct2/rct12/ScenarioPatcher.cpp @@ -27,6 +27,7 @@ #include "../world/Location.hpp" #include "../world/Map.h" #include "../world/Surface.h" +#include "../world/tile_element/EntranceElement.h" #include "../world/tile_element/TileElementType.h" #ifdef DISABLE_NETWORK diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 6cb4f35838..0a5dd0203e 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -77,6 +77,7 @@ #include "../world/Scenery.h" #include "../world/Surface.h" #include "../world/TilePointerIndex.hpp" +#include "../world/tile_element/EntranceElement.h" #include diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index 0c4d1d3969..b19cd45540 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -62,6 +62,7 @@ #include "../world/Park.h" #include "../world/Scenery.h" #include "../world/TileElementsView.h" +#include "../world/tile_element/EntranceElement.h" #include "CableLift.h" #include "RideAudio.h" #include "RideConstruction.h" diff --git a/src/openrct2/ride/RideConstruction.cpp b/src/openrct2/ride/RideConstruction.cpp index 02ae4a8e55..a4d4220adb 100644 --- a/src/openrct2/ride/RideConstruction.cpp +++ b/src/openrct2/ride/RideConstruction.cpp @@ -40,6 +40,7 @@ #include "../world/Park.h" #include "../world/Scenery.h" #include "../world/TileElementsView.h" +#include "../world/tile_element/EntranceElement.h" #include "Ride.h" #include "RideData.h" #include "Track.h" diff --git a/src/openrct2/ride/TrackDesign.cpp b/src/openrct2/ride/TrackDesign.cpp index 6b6e398538..f8bbacf336 100644 --- a/src/openrct2/ride/TrackDesign.cpp +++ b/src/openrct2/ride/TrackDesign.cpp @@ -58,6 +58,7 @@ #include "../world/Scenery.h" #include "../world/Surface.h" #include "../world/Wall.h" +#include "../world/tile_element/EntranceElement.h" #include "../world/tile_element/Slope.h" #include "Ride.h" #include "RideData.h" diff --git a/src/openrct2/ride/TrackDesignSave.cpp b/src/openrct2/ride/TrackDesignSave.cpp index 31bc2daef1..5714b72797 100644 --- a/src/openrct2/ride/TrackDesignSave.cpp +++ b/src/openrct2/ride/TrackDesignSave.cpp @@ -26,6 +26,7 @@ #include "../world/Footpath.h" #include "../world/Scenery.h" #include "../world/Wall.h" +#include "../world/tile_element/EntranceElement.h" #include "RideData.h" #include "Station.h" #include "Track.h" diff --git a/src/openrct2/scripting/bindings/world/ScTileElement.cpp b/src/openrct2/scripting/bindings/world/ScTileElement.cpp index 6d690c882b..6f545616e0 100644 --- a/src/openrct2/scripting/bindings/world/ScTileElement.cpp +++ b/src/openrct2/scripting/bindings/world/ScTileElement.cpp @@ -22,6 +22,7 @@ # include "../../../world/Footpath.h" # include "../../../world/Scenery.h" # include "../../../world/Surface.h" +# include "../../../world/tile_element/EntranceElement.h" # include "../../Duktape.hpp" # include "../../ScriptEngine.h" diff --git a/src/openrct2/world/ConstructionClearance.cpp b/src/openrct2/world/ConstructionClearance.cpp index 726e0a8e08..39f1ab7113 100644 --- a/src/openrct2/world/ConstructionClearance.cpp +++ b/src/openrct2/world/ConstructionClearance.cpp @@ -18,10 +18,11 @@ #include "../openrct2/Cheats.h" #include "../ride/Ride.h" #include "../ride/RideData.h" -#include "../world/tile_element/Slope.h" #include "Park.h" #include "Scenery.h" #include "Surface.h" +#include "tile_element/EntranceElement.h" +#include "tile_element/Slope.h" using namespace OpenRCT2; diff --git a/src/openrct2/world/Entrance.cpp b/src/openrct2/world/Entrance.cpp index a10b6ac9e2..fbcdb7d669 100644 --- a/src/openrct2/world/Entrance.cpp +++ b/src/openrct2/world/Entrance.cpp @@ -30,6 +30,7 @@ #include "Map.h" #include "MapAnimation.h" #include "Park.h" +#include "tile_element/EntranceElement.h" using namespace OpenRCT2; diff --git a/src/openrct2/world/Footpath.cpp b/src/openrct2/world/Footpath.cpp index 9a74e0d680..84be49f337 100644 --- a/src/openrct2/world/Footpath.cpp +++ b/src/openrct2/world/Footpath.cpp @@ -33,12 +33,13 @@ #include "../ride/Track.h" #include "../ride/TrackData.h" #include "../util/Util.h" -#include "../world/tile_element/Slope.h" #include "Location.hpp" #include "Map.h" #include "MapAnimation.h" #include "Surface.h" #include "TileElement.h" +#include "tile_element/EntranceElement.h" +#include "tile_element/Slope.h" #include #include diff --git a/src/openrct2/world/Map.cpp b/src/openrct2/world/Map.cpp index c93a0a7db2..960de4270c 100644 --- a/src/openrct2/world/Map.cpp +++ b/src/openrct2/world/Map.cpp @@ -47,7 +47,6 @@ #include "../util/Util.h" #include "../windows/Intent.h" #include "../world/TilePointerIndex.hpp" -#include "../world/tile_element/Slope.h" #include "Banner.h" #include "Climate.h" #include "Entrance.h" @@ -59,6 +58,8 @@ #include "TileElementsView.h" #include "TileInspector.h" #include "Wall.h" +#include "tile_element/EntranceElement.h" +#include "tile_element/Slope.h" #include #include diff --git a/src/openrct2/world/MapAnimation.cpp b/src/openrct2/world/MapAnimation.cpp index 72cfa5ece1..7b755bbfa4 100644 --- a/src/openrct2/world/MapAnimation.cpp +++ b/src/openrct2/world/MapAnimation.cpp @@ -29,6 +29,7 @@ #include "Footpath.h" #include "Map.h" #include "Scenery.h" +#include "tile_element/EntranceElement.h" using namespace OpenRCT2; diff --git a/src/openrct2/world/Park.cpp b/src/openrct2/world/Park.cpp index cc843e0a5d..a4756a2018 100644 --- a/src/openrct2/world/Park.cpp +++ b/src/openrct2/world/Park.cpp @@ -39,6 +39,7 @@ #include "Entrance.h" #include "Map.h" #include "Surface.h" +#include "tile_element/EntranceElement.h" #include #include diff --git a/src/openrct2/world/TileElement.cpp b/src/openrct2/world/TileElement.cpp index ad8595efdb..e2cba7d7f3 100644 --- a/src/openrct2/world/TileElement.cpp +++ b/src/openrct2/world/TileElement.cpp @@ -18,6 +18,7 @@ #include "Banner.h" #include "Location.hpp" #include "Scenery.h" +#include "tile_element/EntranceElement.h" #include "tile_element/Slope.h" using namespace OpenRCT2; @@ -159,3 +160,13 @@ const QuarterTile QuarterTile::Rotate(uint8_t amount) const return QuarterTile{ 0 }; } } + +const EntranceElement* TileElementBase::AsEntrance() const +{ + return as(); +} + +EntranceElement* TileElementBase::AsEntrance() +{ + return as(); +} diff --git a/src/openrct2/world/TileElement.h b/src/openrct2/world/TileElement.h index 74e78d7a29..acce7757b0 100644 --- a/src/openrct2/world/TileElement.h +++ b/src/openrct2/world/TileElement.h @@ -35,6 +35,7 @@ using track_type_t = uint16_t; constexpr uint8_t MAX_ELEMENT_HEIGHT = 255; constexpr uint8_t OWNER_MASK = 0b00001111; +constexpr uint8_t kTileElementSize = 16; #pragma pack(push, 1) @@ -148,14 +149,8 @@ struct TileElementBase { return as(); } - const EntranceElement* AsEntrance() const - { - return as(); - } - EntranceElement* AsEntrance() - { - return as(); - } + const EntranceElement* AsEntrance() const; + EntranceElement* AsEntrance(); const BannerElement* AsBanner() const { return as(); @@ -548,55 +543,6 @@ public: }; static_assert(sizeof(WallElement) == 16); -struct EntranceElement : TileElementBase -{ - static constexpr TileElementType ElementType = TileElementType::Entrance; - -private: - uint8_t entranceType; // 5 - uint8_t SequenceIndex; // 6. Only uses the lower nibble. - StationIndex stationIndex; // 7 - ObjectEntryIndex PathType; // 8 - RideId rideIndex; // A - uint8_t flags2; // C - ObjectEntryIndex entryIndex; // D -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunused-private-field" - uint8_t Pad0F[1]; -#pragma clang diagnostic pop - -public: - uint8_t GetEntranceType() const; - void SetEntranceType(uint8_t newType); - - RideId GetRideIndex() const; - void SetRideIndex(RideId newRideIndex); - - StationIndex GetStationIndex() const; - void SetStationIndex(StationIndex newStationIndex); - - uint8_t GetSequenceIndex() const; - void SetSequenceIndex(uint8_t newSequenceIndex); - - bool HasLegacyPathEntry() const; - - ObjectEntryIndex GetLegacyPathEntryIndex() const; - const FootpathObject* GetLegacyPathEntry() const; - void SetLegacyPathEntryIndex(ObjectEntryIndex newPathType); - - ObjectEntryIndex GetSurfaceEntryIndex() const; - const FootpathSurfaceObject* GetSurfaceEntry() const; - void SetSurfaceEntryIndex(ObjectEntryIndex newIndex); - - const PathSurfaceDescriptor* GetPathSurfaceDescriptor() const; - - int32_t GetDirections() const; - - ObjectEntryIndex getEntryIndex() const; - void setEntryIndex(ObjectEntryIndex newIndex); -}; -static_assert(sizeof(EntranceElement) == 16); - struct BannerElement : TileElementBase { static constexpr TileElementType ElementType = TileElementType::Banner; @@ -685,13 +631,6 @@ enum TILE_ELEMENT_FLAG_LAST_TILE = (1 << 7) }; -enum -{ - ENTRANCE_TYPE_RIDE_ENTRANCE, - ENTRANCE_TYPE_RIDE_EXIT, - ENTRANCE_TYPE_PARK_ENTRANCE -}; - enum { ELEMENT_IS_ABOVE_GROUND = 1 << 0, diff --git a/src/openrct2/world/TileInspector.cpp b/src/openrct2/world/TileInspector.cpp index 2eacc019da..30223f62e1 100644 --- a/src/openrct2/world/TileInspector.cpp +++ b/src/openrct2/world/TileInspector.cpp @@ -25,6 +25,7 @@ #include "Park.h" #include "Scenery.h" #include "Surface.h" +#include "tile_element/EntranceElement.h" #include "tile_element/Slope.h" #include diff --git a/src/openrct2/world/tile_element/EntranceElement.cpp b/src/openrct2/world/tile_element/EntranceElement.cpp index 86ce7cfa43..385b26f0a4 100644 --- a/src/openrct2/world/tile_element/EntranceElement.cpp +++ b/src/openrct2/world/tile_element/EntranceElement.cpp @@ -7,13 +7,14 @@ * OpenRCT2 is licensed under the GNU General Public License version 3. *****************************************************************************/ +#include "EntranceElement.h" + #include "../../Context.h" #include "../../object/EntranceObject.h" #include "../../object/FootpathObject.h" #include "../../object/FootpathSurfaceObject.h" #include "../../object/ObjectManager.h" #include "../Entrance.h" -#include "../TileElement.h" // rct2: 0x0097B974 static constexpr uint16_t EntranceDirections[] = { diff --git a/src/openrct2/world/tile_element/EntranceElement.h b/src/openrct2/world/tile_element/EntranceElement.h new file mode 100644 index 0000000000..abeb9f43bd --- /dev/null +++ b/src/openrct2/world/tile_element/EntranceElement.h @@ -0,0 +1,75 @@ +/***************************************************************************** + * Copyright (c) 2014-2024 OpenRCT2 developers + * + * For a complete list of all authors, please refer to contributors.md + * Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2 + * + * OpenRCT2 is licensed under the GNU General Public License version 3. + *****************************************************************************/ + +#pragma once + +#include "../../Identifiers.h" +#include "../TileElement.h" + +#include + +enum +{ + ENTRANCE_TYPE_RIDE_ENTRANCE, + ENTRANCE_TYPE_RIDE_EXIT, + ENTRANCE_TYPE_PARK_ENTRANCE +}; + +#pragma pack(push, 1) +struct EntranceElement; + +struct EntranceElement : TileElementBase +{ + static constexpr TileElementType ElementType = TileElementType::Entrance; + +private: + uint8_t entranceType; // 5 + uint8_t SequenceIndex; // 6. Only uses the lower nibble. + StationIndex stationIndex; // 7 + ObjectEntryIndex PathType; // 8 + RideId rideIndex; // A + uint8_t flags2; // C + ObjectEntryIndex entryIndex; // D +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunused-private-field" + uint8_t Pad0F[1]; +#pragma clang diagnostic pop + +public: + uint8_t GetEntranceType() const; + void SetEntranceType(uint8_t newType); + + RideId GetRideIndex() const; + void SetRideIndex(RideId newRideIndex); + + StationIndex GetStationIndex() const; + void SetStationIndex(StationIndex newStationIndex); + + uint8_t GetSequenceIndex() const; + void SetSequenceIndex(uint8_t newSequenceIndex); + + bool HasLegacyPathEntry() const; + + ObjectEntryIndex GetLegacyPathEntryIndex() const; + const FootpathObject* GetLegacyPathEntry() const; + void SetLegacyPathEntryIndex(ObjectEntryIndex newPathType); + + ObjectEntryIndex GetSurfaceEntryIndex() const; + const FootpathSurfaceObject* GetSurfaceEntry() const; + void SetSurfaceEntryIndex(ObjectEntryIndex newIndex); + + const PathSurfaceDescriptor* GetPathSurfaceDescriptor() const; + + int32_t GetDirections() const; + + ObjectEntryIndex getEntryIndex() const; + void setEntryIndex(ObjectEntryIndex newIndex); +}; +static_assert(sizeof(EntranceElement) == kTileElementSize); +#pragma pack(pop) diff --git a/test/tests/TileElements.cpp b/test/tests/TileElements.cpp index 964f6875aa..8eb7b25166 100644 --- a/test/tests/TileElements.cpp +++ b/test/tests/TileElements.cpp @@ -17,6 +17,7 @@ #include #include #include +#include using namespace OpenRCT2; diff --git a/test/tests/TileElementsView.cpp b/test/tests/TileElementsView.cpp index 983ba2bf82..0229ffb4b2 100644 --- a/test/tests/TileElementsView.cpp +++ b/test/tests/TileElementsView.cpp @@ -18,6 +18,7 @@ #include #include #include +#include using namespace OpenRCT2;