diff --git a/src/openrct2-ui/WindowManager.cpp b/src/openrct2-ui/WindowManager.cpp index 3d30bb8a5b..d9832221e4 100644 --- a/src/openrct2-ui/WindowManager.cpp +++ b/src/openrct2-ui/WindowManager.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include diff --git a/src/openrct2-ui/interface/ViewportInteraction.cpp b/src/openrct2-ui/interface/ViewportInteraction.cpp index 1d70cf0b0f..d3534f2dd3 100644 --- a/src/openrct2-ui/interface/ViewportInteraction.cpp +++ b/src/openrct2-ui/interface/ViewportInteraction.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/InstallTrack.cpp b/src/openrct2-ui/windows/InstallTrack.cpp index 9d075d1ef1..222c09d2d5 100644 --- a/src/openrct2-ui/windows/InstallTrack.cpp +++ b/src/openrct2-ui/windows/InstallTrack.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/MazeConstruction.cpp b/src/openrct2-ui/windows/MazeConstruction.cpp index e1d2fe3d8d..77a65c1111 100644 --- a/src/openrct2-ui/windows/MazeConstruction.cpp +++ b/src/openrct2-ui/windows/MazeConstruction.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/Ride.cpp b/src/openrct2-ui/windows/Ride.cpp index e589669915..5e27fe9a1d 100644 --- a/src/openrct2-ui/windows/Ride.cpp +++ b/src/openrct2-ui/windows/Ride.cpp @@ -44,6 +44,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 d0f382a513..7c89d400ba 100644 --- a/src/openrct2-ui/windows/RideConstruction.cpp +++ b/src/openrct2-ui/windows/RideConstruction.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/TrackDesignPlace.cpp b/src/openrct2-ui/windows/TrackDesignPlace.cpp index 87ec03dbb5..29c9956d8e 100644 --- a/src/openrct2-ui/windows/TrackDesignPlace.cpp +++ b/src/openrct2-ui/windows/TrackDesignPlace.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2-ui/windows/TrackList.cpp b/src/openrct2-ui/windows/TrackList.cpp index c476c08947..234dd38d27 100644 --- a/src/openrct2-ui/windows/TrackList.cpp +++ b/src/openrct2-ui/windows/TrackList.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include diff --git a/src/openrct2/actions/FootpathPlaceAction.cpp b/src/openrct2/actions/FootpathPlaceAction.cpp index a856b55adb..4428e64c0d 100644 --- a/src/openrct2/actions/FootpathPlaceAction.cpp +++ b/src/openrct2/actions/FootpathPlaceAction.cpp @@ -15,6 +15,7 @@ #include "../interface/Window.h" #include "../localisation/StringIds.h" #include "../management/Finance.h" +#include "../ride/RideConstruction.h" #include "../world/ConstructionClearance.h" #include "../world/Footpath.h" #include "../world/Location.hpp" diff --git a/src/openrct2/actions/FootpathPlaceFromTrackAction.cpp b/src/openrct2/actions/FootpathPlaceFromTrackAction.cpp index b5a6d42e4a..b532f4a36b 100644 --- a/src/openrct2/actions/FootpathPlaceFromTrackAction.cpp +++ b/src/openrct2/actions/FootpathPlaceFromTrackAction.cpp @@ -15,6 +15,7 @@ #include "../interface/Window.h" #include "../localisation/StringIds.h" #include "../management/Finance.h" +#include "../ride/RideConstruction.h" #include "../world/ConstructionClearance.h" #include "../world/Footpath.h" #include "../world/Location.hpp" diff --git a/src/openrct2/actions/LandLowerAction.cpp b/src/openrct2/actions/LandLowerAction.cpp index 00d6986540..702697fa38 100644 --- a/src/openrct2/actions/LandLowerAction.cpp +++ b/src/openrct2/actions/LandLowerAction.cpp @@ -17,6 +17,7 @@ #include "../localisation/Localisation.h" #include "../localisation/StringIds.h" #include "../management/Finance.h" +#include "../ride/RideConstruction.h" #include "../ride/RideData.h" #include "../windows/Intent.h" #include "../world/Park.h" diff --git a/src/openrct2/actions/LandRaiseAction.cpp b/src/openrct2/actions/LandRaiseAction.cpp index ccc124b391..e9585e0d7b 100644 --- a/src/openrct2/actions/LandRaiseAction.cpp +++ b/src/openrct2/actions/LandRaiseAction.cpp @@ -18,6 +18,7 @@ #include "../localisation/Localisation.h" #include "../localisation/StringIds.h" #include "../management/Finance.h" +#include "../ride/RideConstruction.h" #include "../ride/RideData.h" #include "../windows/Intent.h" #include "../world/Park.h" diff --git a/src/openrct2/actions/LargeSceneryPlaceAction.cpp b/src/openrct2/actions/LargeSceneryPlaceAction.cpp index eec2979b57..828bafac5a 100644 --- a/src/openrct2/actions/LargeSceneryPlaceAction.cpp +++ b/src/openrct2/actions/LargeSceneryPlaceAction.cpp @@ -13,6 +13,7 @@ #include "../management/Finance.h" #include "../object/ObjectLimits.h" #include "../ride/Ride.h" +#include "../ride/RideConstruction.h" #include "../world/Banner.h" #include "../world/ConstructionClearance.h" #include "../world/MapAnimation.h" diff --git a/src/openrct2/actions/RideSetColourSchemeAction.cpp b/src/openrct2/actions/RideSetColourSchemeAction.cpp index 5273eb56d3..ac37d7e4b2 100644 --- a/src/openrct2/actions/RideSetColourSchemeAction.cpp +++ b/src/openrct2/actions/RideSetColourSchemeAction.cpp @@ -17,6 +17,7 @@ #include "../localisation/StringIds.h" #include "../management/Finance.h" #include "../ride/Ride.h" +#include "../ride/RideConstruction.h" #include "../world/Park.h" RideSetColourSchemeAction::RideSetColourSchemeAction( diff --git a/src/openrct2/actions/TrackDesignAction.cpp b/src/openrct2/actions/TrackDesignAction.cpp index 9907ed7879..1d4fde195a 100644 --- a/src/openrct2/actions/TrackDesignAction.cpp +++ b/src/openrct2/actions/TrackDesignAction.cpp @@ -15,6 +15,7 @@ #include "../object/ObjectManager.h" #include "../object/ObjectRepository.h" #include "../rct12/RCT12.h" +#include "../ride/RideConstruction.h" #include "../ride/TrackDesign.h" #include "RideCreateAction.h" #include "RideDemolishAction.h" diff --git a/src/openrct2/actions/WaterLowerAction.cpp b/src/openrct2/actions/WaterLowerAction.cpp index 38ab72f4d6..c6f1e2e82d 100644 --- a/src/openrct2/actions/WaterLowerAction.cpp +++ b/src/openrct2/actions/WaterLowerAction.cpp @@ -11,6 +11,7 @@ #include "../OpenRCT2.h" #include "../audio/audio.h" +#include "../ride/RideConstruction.h" #include "WaterSetHeightAction.h" WaterLowerAction::WaterLowerAction(MapRange range) diff --git a/src/openrct2/actions/WaterRaiseAction.cpp b/src/openrct2/actions/WaterRaiseAction.cpp index d42749b088..279c395622 100644 --- a/src/openrct2/actions/WaterRaiseAction.cpp +++ b/src/openrct2/actions/WaterRaiseAction.cpp @@ -11,6 +11,7 @@ #include "../OpenRCT2.h" #include "../audio/audio.h" +#include "../ride/RideConstruction.h" #include "WaterSetHeightAction.h" WaterRaiseAction::WaterRaiseAction(MapRange range) diff --git a/src/openrct2/libopenrct2.vcxproj b/src/openrct2/libopenrct2.vcxproj index d414eda04b..3bcbf55e5f 100644 --- a/src/openrct2/libopenrct2.vcxproj +++ b/src/openrct2/libopenrct2.vcxproj @@ -392,6 +392,7 @@ + diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index a355872d6f..dac2e978d8 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -59,6 +59,7 @@ #include "../world/TileElementsView.h" #include "CableLift.h" #include "RideAudio.h" +#include "RideConstruction.h" #include "RideData.h" #include "RideEntry.h" #include "ShopItem.h" diff --git a/src/openrct2/ride/Ride.h b/src/openrct2/ride/Ride.h index f73bb04445..4c541789a7 100644 --- a/src/openrct2/ride/Ride.h +++ b/src/openrct2/ride/Ride.h @@ -797,19 +797,6 @@ enum RIDE_CRASH_TYPE_FATALITIES = 8 }; -enum class RideConstructionState : uint8_t -{ - State0, - Front, - Back, - Selected, - Place, - EntranceExit, - MazeBuild, - MazeMove, - MazeFill -}; - enum { RIDE_SET_VEHICLES_COMMAND_TYPE_NUM_TRAINS, @@ -986,45 +973,6 @@ extern money16 gTotalRideValueForMoney; extern const rct_string_id ColourSchemeNames[4]; -extern money32 _currentTrackPrice; - -extern uint16_t _numCurrentPossibleRideConfigurations; -extern uint16_t _numCurrentPossibleSpecialTrackPieces; - -extern uint32_t _currentTrackCurve; -extern RideConstructionState _rideConstructionState; -extern ride_id_t _currentRideIndex; - -extern CoordsXYZ _currentTrackBegin; - -extern uint8_t _currentTrackPieceDirection; -extern track_type_t _currentTrackPieceType; -extern uint8_t _currentTrackSelectionFlags; -extern uint32_t _rideConstructionNextArrowPulse; -extern uint8_t _currentTrackSlopeEnd; -extern uint8_t _currentTrackBankEnd; -extern uint8_t _currentTrackLiftHill; -extern uint8_t _currentTrackAlternative; -extern track_type_t _selectedTrackType; - -extern uint8_t _previousTrackBankEnd; -extern uint8_t _previousTrackSlopeEnd; - -extern CoordsXYZ _previousTrackPiece; - -extern uint8_t _currentBrakeSpeed2; -extern uint8_t _currentSeatRotationAngle; - -extern CoordsXYZD _unkF440C5; - -extern uint8_t gRideEntranceExitPlaceType; -extern ride_id_t gRideEntranceExitPlaceRideIndex; -extern StationIndex gRideEntranceExitPlaceStationIndex; -extern RideConstructionState gRideEntranceExitPlacePreviousRideConstructionState; -extern uint8_t gRideEntranceExitPlaceDirection; - -extern bool gGotoStartPlacementMode; - extern ObjectEntryIndex gLastEntranceStyle; int32_t ride_get_count(); @@ -1037,7 +985,6 @@ bool ride_try_get_origin_element(const Ride* ride, CoordsXYE* output); int32_t ride_find_track_gap(const Ride* ride, CoordsXYE* input, CoordsXYE* output); void ride_construct_new(RideSelection listItem); void ride_construct(Ride* ride); -bool ride_modify(CoordsXYE* input); void ride_clear_blocked_tiles(Ride* ride); Staff* ride_get_mechanic(Ride* ride); Staff* ride_get_assigned_mechanic(Ride* ride); @@ -1049,9 +996,6 @@ void ride_measurements_update(); void ride_breakdown_add_news_item(Ride* ride); Staff* ride_find_closest_mechanic(Ride* ride, int32_t forInspection); int32_t ride_initialise_construction_window(Ride* ride); -void ride_construction_invalidate_current_track(); -std::optional GetTrackElementOriginAndApplyChanges( - const CoordsXYZD& location, track_type_t type, uint16_t extra_params, TileElement** output_element, uint16_t flags); void ride_set_map_tooltip(TileElement* tileElement); void ride_prepare_breakdown(Ride* ride, int32_t breakdownReason); TileElement* ride_get_station_start_track_element(const Ride* ride, StationIndex stationIndex); @@ -1063,15 +1007,8 @@ int32_t ride_get_random_colour_preset_index(uint8_t ride_type); money32 ride_get_common_price(Ride* forRide); void ride_clear_for_construction(Ride* ride); -void ride_entrance_exit_place_provisional_ghost(); -void ride_entrance_exit_remove_ghost(); -void ride_restore_provisional_track_piece(); -void ride_remove_provisional_track_piece(); void invalidate_test_results(Ride* ride); -void ride_select_next_section(); -void ride_select_previous_section(); - void increment_turn_count_1_element(Ride* ride, uint8_t type); void increment_turn_count_2_elements(Ride* ride, uint8_t type); void increment_turn_count_3_elements(Ride* ride, uint8_t type); @@ -1085,8 +1022,6 @@ uint8_t ride_get_helix_sections(Ride* ride); bool ride_has_any_track_elements(const Ride* ride); -void ride_construction_set_default_next_piece(); - bool track_block_get_next(CoordsXYE* input, CoordsXYE* output, int32_t* z, int32_t* direction); bool track_block_get_next_from_zero( const CoordsXYZ& startPos, Ride* ride, uint8_t direction_start, CoordsXYE* output, int32_t* z, int32_t* direction, @@ -1099,13 +1034,8 @@ bool track_block_get_previous_from_zero( void ride_get_start_of_track(CoordsXYE* output); void window_ride_construction_update_active_elements(); -void ride_construction_remove_ghosts(); money32 ride_entrance_exit_place_ghost( Ride* ride, const CoordsXY& entranceExitCoords, Direction direction, int32_t placeType, StationIndex stationNum); -CoordsXYZD ride_get_entrance_or_exit_position_from_screen_position(const ScreenCoordsXY& screenCoords); - -bool ride_select_backwards_from_front(); -bool ride_select_forwards_from_back(); bool ride_are_all_possible_entrances_and_exits_built(Ride* ride); void ride_fix_breakdown(Ride* ride, int32_t reliabilityIncreaseFactor); diff --git a/src/openrct2/ride/RideConstruction.cpp b/src/openrct2/ride/RideConstruction.cpp index c506237ed8..c0befc08ac 100644 --- a/src/openrct2/ride/RideConstruction.cpp +++ b/src/openrct2/ride/RideConstruction.cpp @@ -7,6 +7,8 @@ * OpenRCT2 is licensed under the GNU General Public License version 3. *****************************************************************************/ +#include "RideConstruction.h" + #include "../Context.h" #include "../Input.h" #include "../actions/RideEntranceExitRemoveAction.h" diff --git a/src/openrct2/ride/RideConstruction.h b/src/openrct2/ride/RideConstruction.h new file mode 100644 index 0000000000..bba56f4d8a --- /dev/null +++ b/src/openrct2/ride/RideConstruction.h @@ -0,0 +1,99 @@ +/***************************************************************************** + * Copyright (c) 2014-2021 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 "../common.h" +#include "../world/Location.hpp" +#include "Station.h" + +#include +#include + +using track_type_t = uint16_t; +enum class ride_id_t : uint16_t; + +struct TileElement; +struct CoordsXYE; + +enum class RideConstructionState : uint8_t +{ + State0, + Front, + Back, + Selected, + Place, + EntranceExit, + MazeBuild, + MazeMove, + MazeFill +}; + +extern bool gGotoStartPlacementMode; + +extern money32 _currentTrackPrice; + +extern uint16_t _numCurrentPossibleRideConfigurations; +extern uint16_t _numCurrentPossibleSpecialTrackPieces; + +extern uint32_t _currentTrackCurve; +extern RideConstructionState _rideConstructionState; +extern ride_id_t _currentRideIndex; + +extern CoordsXYZ _currentTrackBegin; + +extern uint8_t _currentTrackPieceDirection; +extern track_type_t _currentTrackPieceType; +extern uint8_t _currentTrackSelectionFlags; +extern uint32_t _rideConstructionNextArrowPulse; +extern uint8_t _currentTrackSlopeEnd; +extern uint8_t _currentTrackBankEnd; +extern uint8_t _currentTrackLiftHill; +extern uint8_t _currentTrackAlternative; +extern track_type_t _selectedTrackType; + +extern uint8_t _previousTrackBankEnd; +extern uint8_t _previousTrackSlopeEnd; + +extern CoordsXYZ _previousTrackPiece; + +extern uint8_t _currentBrakeSpeed2; +extern uint8_t _currentSeatRotationAngle; + +extern CoordsXYZD _unkF440C5; + +extern uint8_t gRideEntranceExitPlaceType; +extern ride_id_t gRideEntranceExitPlaceRideIndex; +extern StationIndex gRideEntranceExitPlaceStationIndex; +extern RideConstructionState gRideEntranceExitPlacePreviousRideConstructionState; +extern uint8_t gRideEntranceExitPlaceDirection; + +std::optional GetTrackElementOriginAndApplyChanges( + const CoordsXYZD& location, track_type_t type, uint16_t extra_params, TileElement** output_element, uint16_t flags); + +void ride_entrance_exit_place_provisional_ghost(); +void ride_entrance_exit_remove_ghost(); +void ride_restore_provisional_track_piece(); +void ride_remove_provisional_track_piece(); + +void ride_construction_remove_ghosts(); + +void ride_construction_invalidate_current_track(); + +void ride_construction_set_default_next_piece(); + +void ride_select_next_section(); +void ride_select_previous_section(); + +bool ride_modify(CoordsXYE* input); + +CoordsXYZD ride_get_entrance_or_exit_position_from_screen_position(const ScreenCoordsXY& screenCoords); + +bool ride_select_backwards_from_front(); +bool ride_select_forwards_from_back(); diff --git a/src/openrct2/ride/TrackDesign.cpp b/src/openrct2/ride/TrackDesign.cpp index afdc27b8da..6109cc3c19 100644 --- a/src/openrct2/ride/TrackDesign.cpp +++ b/src/openrct2/ride/TrackDesign.cpp @@ -47,6 +47,7 @@ #include "../object/ObjectRepository.h" #include "../rct1/RCT1.h" #include "../rct1/Tables.h" +#include "../ride/RideConstruction.h" #include "../util/SawyerCoding.h" #include "../util/Util.h" #include "../world/Footpath.h" diff --git a/src/openrct2/windows/_legacy.cpp b/src/openrct2/windows/_legacy.cpp index 22458f873b..69c3911ba2 100644 --- a/src/openrct2/windows/_legacy.cpp +++ b/src/openrct2/windows/_legacy.cpp @@ -17,6 +17,7 @@ #include "../interface/Viewport.h" #include "../network/network.h" #include "../paint/VirtualFloor.h" +#include "../ride/RideConstruction.h" #include "../ride/RideData.h" #include "../ride/Track.h" #include "../ride/TrackData.h" diff --git a/src/openrct2/world/Entrance.cpp b/src/openrct2/world/Entrance.cpp index d761500db9..3043a4aaf7 100644 --- a/src/openrct2/world/Entrance.cpp +++ b/src/openrct2/world/Entrance.cpp @@ -22,6 +22,7 @@ #include "../object/FootpathObject.h" #include "../object/FootpathSurfaceObject.h" #include "../object/ObjectManager.h" +#include "../ride/RideConstruction.h" #include "../ride/Station.h" #include "../ride/Track.h" #include "Footpath.h" diff --git a/src/openrct2/world/Map.cpp b/src/openrct2/world/Map.cpp index ab07ab935c..e9a6792743 100644 --- a/src/openrct2/world/Map.cpp +++ b/src/openrct2/world/Map.cpp @@ -36,6 +36,7 @@ #include "../network/network.h" #include "../object/ObjectManager.h" #include "../object/TerrainSurfaceObject.h" +#include "../ride/RideConstruction.h" #include "../ride/RideData.h" #include "../ride/Track.h" #include "../ride/TrackData.h"