diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index 796c6d8abc..333d49c524 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -1046,12 +1046,12 @@ const RideStation& Ride::GetStation(StationIndex stationIndex) const return stations[stationIndex.ToUnderlying()]; } -std::array& Ride::GetStations() +std::span Ride::GetStations() { return stations; } -const std::array& Ride::GetStations() const +std::span Ride::GetStations() const { return stations; } diff --git a/src/openrct2/ride/Ride.h b/src/openrct2/ride/Ride.h index 3db9ed6e76..36b302156b 100644 --- a/src/openrct2/ride/Ride.h +++ b/src/openrct2/ride/Ride.h @@ -28,6 +28,7 @@ #include #include #include +#include #include struct IObjectManager; @@ -293,8 +294,8 @@ private: public: RideStation& GetStation(StationIndex stationIndex = StationIndex::FromUnderlying(0)); const RideStation& GetStation(StationIndex stationIndex = StationIndex::FromUnderlying(0)) const; - std::array& GetStations(); - const std::array& GetStations() const; + std::span GetStations(); + std::span GetStations() const; StationIndex GetStationIndex(const RideStation* station) const; // Returns the logical station number from the given station. Index 0 = station 1, index 1 = station 2. It accounts for gaps diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index 8dfa7c7be1..ad7518d355 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -2308,7 +2308,7 @@ static void test_finish(Ride& ride) ride.lifecycle_flags &= ~RIDE_LIFECYCLE_TEST_IN_PROGRESS; ride.lifecycle_flags |= RIDE_LIFECYCLE_TESTED; - auto& rideStations = ride.GetStations(); + auto rideStations = ride.GetStations(); for (int32_t i = ride.num_stations - 1; i >= 1; i--) { if (rideStations[i - 1].SegmentTime != 0) diff --git a/src/openrct2/world/Map.cpp b/src/openrct2/world/Map.cpp index 7ed0c325f3..cc1a0efd54 100644 --- a/src/openrct2/world/Map.cpp +++ b/src/openrct2/world/Map.cpp @@ -2352,7 +2352,7 @@ void ShiftMap(const TileCoordsXY& amount) // Rides for (auto& ride : GetRideManager()) { - auto& stations = ride.GetStations(); + auto stations = ride.GetStations(); for (auto& station : stations) { shiftIfNotNull(station.Start, amountToMove);