From 18fa68813d03364ba4540445b2fc55b4a210d88f Mon Sep 17 00:00:00 2001 From: ZehMatt Date: Mon, 2 Aug 2021 09:09:51 +0300 Subject: [PATCH] Adjust importer/exporter --- src/openrct2/rct2/S6Exporter.cpp | 14 +++++++------- src/openrct2/rct2/S6Importer.cpp | 12 +++++++----- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index 2cffe9bc09..a1ef85dc30 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -609,7 +609,7 @@ void S6Exporter::ExportRides() const Ride nullRide{}; for (int32_t index = 0; index < RCT12_MAX_RIDES_IN_PARK; index++) { - const auto* src = get_ride(index); + const auto* src = get_ride(static_cast(index)); if (src == nullptr) { src = &nullRide; @@ -931,9 +931,9 @@ void S6Exporter::ExportRideMeasurements() { // Get all the ride measurements std::vector ridesWithMeasurements; - for (ride_id_t i = 0; i < RCT12_MAX_RIDES_IN_PARK; i++) + for (size_t i = 0; i < RCT12_MAX_RIDES_IN_PARK; i++) { - auto ride = get_ride(i); + auto ride = get_ride(static_cast(i)); if (ride != nullptr && ride->measurement != nullptr) { ridesWithMeasurements.push_back(ride); @@ -958,8 +958,8 @@ void S6Exporter::ExportRideMeasurements() ExportRideMeasurement(_s6.ride_measurements[i], *src->measurement.get()); auto rideId = src->id; - dst.ride_index = rideId; - _s6.rides[rideId].measurement_index = i; + dst.ride_index = static_cast(rideId); + _s6.rides[static_cast(rideId)].measurement_index = i; i++; } } @@ -1224,7 +1224,7 @@ template<> void S6Exporter::ExportEntity(RCT2SpriteVehicle* dst, const Vehicle* dst->remaining_distance = src->remaining_distance; dst->velocity = src->velocity; dst->acceleration = src->acceleration; - dst->ride = src->ride; + dst->ride = static_cast(src->ride); dst->vehicle_type = src->vehicle_type; dst->colours = src->colours; dst->track_progress = src->track_progress; @@ -1840,7 +1840,7 @@ void S6Exporter::ExportTileElement(RCT12TileElement* dst, const TileElement* src // Skipping IsHighlighted() // This has to be done last, since the maze entry shares fields with the colour and sequence fields. - auto ride = get_ride(dst2->GetRideIndex()); + auto ride = get_ride(static_cast(dst2->GetRideIndex())); if (ride) { if (ride->type == RIDE_TYPE_MAZE) diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 5510056d77..1ae9885831 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -530,8 +530,9 @@ public: auto src = &_s6.rides[index]; if (src->type != RIDE_TYPE_NULL) { - auto dst = GetOrAllocateRide(index); - ImportRide(dst, src, index); + const auto rideId = static_cast(index); + auto dst = GetOrAllocateRide(rideId); + ImportRide(dst, src, rideId); } } } @@ -872,7 +873,8 @@ public: { if (src.ride_index != RCT12_RIDE_ID_NULL) { - auto ride = get_ride(src.ride_index); + const auto rideId = static_cast(src.ride_index); + auto ride = get_ride(rideId); if (ride != nullptr) { ride->measurement = std::make_unique(); @@ -1061,7 +1063,7 @@ public: { if (sprite.unknown.sprite_identifier == RCT12SpriteIdentifier::Peep) { - if (sprite.peep.current_ride == rideIndex + if (sprite.peep.current_ride == static_cast(rideIndex) && (static_cast(sprite.peep.state) == PeepState::OnRide || static_cast(sprite.peep.state) == PeepState::EnteringRide)) { @@ -1597,7 +1599,7 @@ template<> void S6Importer::ImportEntity(const RCT12SpriteBase& baseSrc dst->remaining_distance = src->remaining_distance; dst->velocity = src->velocity; dst->acceleration = src->acceleration; - dst->ride = src->ride; + dst->ride = static_cast(src->ride); dst->vehicle_type = src->vehicle_type; dst->colours = src->colours; dst->track_progress = src->track_progress;