diff --git a/CMakeLists.txt b/CMakeLists.txt
index 38a7072f10..014a32925c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -81,9 +81,9 @@ set(OPENMSX_VERSION "1.6")
set(OPENMSX_URL "https://github.com/OpenRCT2/OpenMusic/releases/download/v${OPENMSX_VERSION}/openmusic.zip")
set(OPENMSX_SHA1 "ba170fa6d777b309c15420f4b6eb3fa25082a9d1")
-set(REPLAYS_VERSION "0.0.85")
+set(REPLAYS_VERSION "0.0.86")
set(REPLAYS_URL "https://github.com/OpenRCT2/replays/releases/download/v${REPLAYS_VERSION}/replays.zip")
-set(REPLAYS_SHA1 "2B0939953A41D2CE82809CB7C21FC3883578383F")
+set(REPLAYS_SHA1 "637E73F20C03DCD52ACA36FAEE15DADB31797FE0")
option(FORCE32 "Force 32-bit build. It will add `-m32` to compiler flags.")
option(WITH_TESTS "Build tests")
diff --git a/openrct2.proj b/openrct2.proj
index 4ec99e95d6..a8e1d0ac7f 100644
--- a/openrct2.proj
+++ b/openrct2.proj
@@ -51,8 +51,8 @@
b1b1f1b241d2cbff63a1889c4dc5a09bdf769bfb
https://github.com/OpenRCT2/OpenMusic/releases/download/v1.6/openmusic.zip
ba170fa6d777b309c15420f4b6eb3fa25082a9d1
- https://github.com/OpenRCT2/replays/releases/download/v0.0.85/replays.zip
- 2B0939953A41D2CE82809CB7C21FC3883578383F
+ https://github.com/OpenRCT2/replays/releases/download/v0.0.86/replays.zip
+ 637E73F20C03DCD52ACA36FAEE15DADB31797FE0
diff --git a/src/openrct2/actions/RideCreateAction.cpp b/src/openrct2/actions/RideCreateAction.cpp
index be4d39e8c6..235106cf61 100644
--- a/src/openrct2/actions/RideCreateAction.cpp
+++ b/src/openrct2/actions/RideCreateAction.cpp
@@ -28,6 +28,8 @@
#include "../scenario/Scenario.h"
#include "../world/Park.h"
+#include
+
using namespace OpenRCT2;
RideCreateAction::RideCreateAction(
@@ -147,18 +149,12 @@ GameActions::Result RideCreateAction::Execute() const
ride->overall_view.SetNull();
ride->SetNameToDefault();
- for (auto& station : ride->GetStations())
- {
- station.Start.SetNull();
- station.Entrance.SetNull();
- station.Exit.SetNull();
- station.TrainAtStation = RideStation::kNoTrain;
- station.QueueTime = 0;
- station.SegmentLength = 0;
- station.QueueLength = 0;
- station.Length = 0;
- station.Height = 0;
- }
+ // Default initialize all stations.
+ RideStation station{};
+ station.Start.SetNull();
+ station.Entrance.SetNull();
+ station.Exit.SetNull();
+ std::ranges::fill(ride->GetStations(), station);
ride->status = RideStatus::Closed;
ride->NumTrains = 1;
diff --git a/src/openrct2/core/OrcaStream.hpp b/src/openrct2/core/OrcaStream.hpp
index a4030e4c40..d59cdb53cc 100644
--- a/src/openrct2/core/OrcaStream.hpp
+++ b/src/openrct2/core/OrcaStream.hpp
@@ -20,6 +20,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -468,15 +469,8 @@ namespace OpenRCT2
}
}
- template
- void ReadWriteArray(TArr (&arr)[TArrSize], TFunc f)
- {
- auto& arr2 = *(reinterpret_cast*>(arr));
- ReadWriteArray(arr2, f);
- }
-
- template
- void ReadWriteArray(std::array& arr, TFunc f)
+ template
+ void ReadWriteArray(std::span arr, TFunc f)
{
if (_mode == Mode::READING)
{
@@ -487,7 +481,7 @@ namespace OpenRCT2
}
for (size_t i = 0; i < count; i++)
{
- if (i < TArrSize)
+ if (i < arr.size())
{
f(arr[i]);
}
@@ -509,6 +503,18 @@ namespace OpenRCT2
}
}
+ template
+ void ReadWriteArray(TArr (&arr)[TArrSize], TFunc f)
+ {
+ ReadWriteArray(std::span{ arr, TArrSize }, f);
+ }
+
+ template
+ void ReadWriteArray(std::array& arr, TFunc f)
+ {
+ ReadWriteArray(std::span{ arr.begin(), arr.end() }, f);
+ }
+
template
void Ignore()
{
diff --git a/src/openrct2/entity/EntityRegistry.cpp b/src/openrct2/entity/EntityRegistry.cpp
index de7e54a43d..f4592de1d0 100644
--- a/src/openrct2/entity/EntityRegistry.cpp
+++ b/src/openrct2/entity/EntityRegistry.cpp
@@ -531,6 +531,8 @@ static void FreeEntity(EntityBase& entity)
else if (guest != nullptr)
{
guest->SetName({});
+ guest->GuestNextInQueue = EntityId::GetNull();
+
OpenRCT2::RideUse::GetHistory().RemoveHandle(guest->Id);
OpenRCT2::RideUse::GetTypeHistory().RemoveHandle(guest->Id);
}
diff --git a/src/openrct2/entity/Guest.cpp b/src/openrct2/entity/Guest.cpp
index 9b14e4b5cc..bec70cc448 100644
--- a/src/openrct2/entity/Guest.cpp
+++ b/src/openrct2/entity/Guest.cpp
@@ -7280,6 +7280,7 @@ Guest* Guest::Generate(const CoordsXYZ& coords)
peep->ResetPathfindGoal();
peep->RemoveAllItems();
peep->GuestHeadingToRideId = RideId::GetNull();
+ peep->GuestNextInQueue = EntityId::GetNull();
peep->LitterCount = 0;
peep->DisgustingCount = 0;
peep->VandalismSeen = 0;
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);