mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-18 04:23:20 +01:00
Clamp inspection interval when importing from S4/S6
This commit is contained in:
@@ -17,7 +17,6 @@
|
||||
#include "../world/ParkData.h"
|
||||
#include "Limits.h"
|
||||
|
||||
enum class RideInspection : uint8_t;
|
||||
enum class VehicleColourSettings : uint8_t;
|
||||
|
||||
namespace OpenRCT2::Scenario
|
||||
@@ -382,7 +381,7 @@ namespace OpenRCT2::RCT1
|
||||
};
|
||||
uint8_t unreliabilityFactor; // 0x148
|
||||
uint8_t downtime; // 0x149
|
||||
RideInspection inspectionInterval; // 0x14A
|
||||
uint8_t inspectionInterval; // 0x14A
|
||||
uint8_t lastInspection; // 0x14B
|
||||
uint8_t unk14C[20]; // 0x14C
|
||||
money32 incomePerHour; // 0x160
|
||||
|
||||
@@ -1007,7 +1007,8 @@ namespace OpenRCT2::RCT1
|
||||
|
||||
// Maintenance
|
||||
dst->buildDate = static_cast<int32_t>(src->buildDate);
|
||||
dst->inspectionInterval = src->inspectionInterval;
|
||||
auto clampedInspectionInterval = std::clamp<uint8_t>(src->inspectionInterval, 0, EnumValue(RideInspection::never));
|
||||
dst->inspectionInterval = static_cast<RideInspection>(clampedInspectionInterval);
|
||||
dst->lastInspection = src->lastInspection;
|
||||
dst->reliability = src->reliability;
|
||||
dst->unreliabilityFactor = src->unreliabilityFactor;
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
struct RideObjectEntry;
|
||||
enum class EditorStep : uint8_t;
|
||||
enum class VehicleColourSettings : uint8_t;
|
||||
enum class RideInspection : uint8_t;
|
||||
|
||||
namespace OpenRCT2::Scenario
|
||||
{
|
||||
@@ -261,7 +260,7 @@ namespace OpenRCT2::RCT2
|
||||
uint8_t unreliabilityFactor; // 0x198
|
||||
// Range from [0, 100]
|
||||
uint8_t downtime; // 0x199
|
||||
RideInspection inspectionInterval; // 0x19A
|
||||
uint8_t inspectionInterval; // 0x19A
|
||||
uint8_t lastInspection; // 0x19B
|
||||
uint8_t downtimeHistory[Limits::kDowntimeHistorySize]; // 0x19C
|
||||
uint32_t numPrimaryItemsSold; // 0x1A4
|
||||
|
||||
@@ -932,7 +932,8 @@ namespace OpenRCT2::RCT2
|
||||
dst->reliability = src->reliability;
|
||||
dst->unreliabilityFactor = src->unreliabilityFactor;
|
||||
dst->downtime = src->downtime;
|
||||
dst->inspectionInterval = src->inspectionInterval;
|
||||
auto clampedInspectionInterval = std::clamp<uint8_t>(src->inspectionInterval, 0, EnumValue(RideInspection::never));
|
||||
dst->inspectionInterval = static_cast<RideInspection>(clampedInspectionInterval);
|
||||
dst->lastInspection = src->lastInspection;
|
||||
|
||||
for (uint8_t i = 0; i < Limits::kDowntimeHistorySize; i++)
|
||||
|
||||
Reference in New Issue
Block a user