mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-11 10:02:27 +01:00
Adjust more constants to new constexpr notation (#22463)
* Rename DUCK_MAX_STATES to kDuckMaxStates * Rename DuckMoveOffset to kDuckMoveOffset * Rename DuckAnimationFlyToWater to kDuckAnimationFlyToWater * Rename DuckAnimationSwim to kDuckAnimationSwim * Rename DuckAnimationDrink to kDuckAnimationDrink * Rename DuckAnimationDoubleDrink to kDuckAnimationDoubleDrink * Rename DuckAnimationFlyAway to kDuckAnimationFlyAway * Rename DuckAnimations to kDuckAnimations * Rename ReplayVersion to kReplayVersion * Rename ReplayMagic to kReplayMagic * Rename ReplayCompressionLevel to kReplayCompressionLevel * Rename NormalRecordingChecksumTicks to kNormalRecordingChecksumTicks * Rename SilentRecordingChecksumTicks to kSilentRecordingChecksumTicks * Rename WindowButtonsOnTheLeftDefault to kWindowButtonsOnTheLeftDefault
This commit is contained in:
@@ -102,11 +102,11 @@ namespace OpenRCT2
|
||||
|
||||
class ReplayManager final : public IReplayManager
|
||||
{
|
||||
static constexpr uint16_t ReplayVersion = 10;
|
||||
static constexpr uint32_t ReplayMagic = 0x5243524F; // ORCR.
|
||||
static constexpr int ReplayCompressionLevel = 9;
|
||||
static constexpr int NormalRecordingChecksumTicks = 1;
|
||||
static constexpr int SilentRecordingChecksumTicks = 40; // Same as network server
|
||||
static constexpr uint16_t kReplayVersion = 10;
|
||||
static constexpr uint32_t kReplayMagic = 0x5243524F; // ORCR.
|
||||
static constexpr int kReplayCompressionLevel = 9;
|
||||
static constexpr int kNormalRecordingChecksumTicks = 1;
|
||||
static constexpr int kSilentRecordingChecksumTicks = 40; // Same as network server
|
||||
|
||||
enum class ReplayMode
|
||||
{
|
||||
@@ -241,8 +241,8 @@ namespace OpenRCT2
|
||||
const auto currentTicks = GetGameState().CurrentTicks;
|
||||
|
||||
auto replayData = std::make_unique<ReplayRecordData>();
|
||||
replayData->magic = ReplayMagic;
|
||||
replayData->version = ReplayVersion;
|
||||
replayData->magic = kReplayMagic;
|
||||
replayData->version = kReplayVersion;
|
||||
replayData->networkId = NetworkGetVersion();
|
||||
replayData->name = name;
|
||||
replayData->tickStart = currentTicks;
|
||||
@@ -320,7 +320,7 @@ namespace OpenRCT2
|
||||
auto compressBuf = std::make_unique<unsigned char[]>(compressLength);
|
||||
compress2(
|
||||
compressBuf.get(), &compressLength, static_cast<const unsigned char*>(stream.GetData()), stream.GetLength(),
|
||||
ReplayCompressionLevel);
|
||||
kReplayCompressionLevel);
|
||||
file.data.Write(compressBuf.get(), compressLength);
|
||||
|
||||
DataSerialiser fileSerialiser(true);
|
||||
@@ -522,9 +522,9 @@ namespace OpenRCT2
|
||||
{
|
||||
default:
|
||||
case RecordType::NORMAL:
|
||||
return NormalRecordingChecksumTicks;
|
||||
return kNormalRecordingChecksumTicks;
|
||||
case RecordType::SILENT:
|
||||
return SilentRecordingChecksumTicks;
|
||||
return kSilentRecordingChecksumTicks;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -723,21 +723,21 @@ namespace OpenRCT2
|
||||
|
||||
bool Compatible(ReplayRecordData& data)
|
||||
{
|
||||
return data.version == ReplayVersion;
|
||||
return data.version == kReplayVersion;
|
||||
}
|
||||
|
||||
bool Serialise(DataSerialiser& serialiser, ReplayRecordData& data)
|
||||
{
|
||||
serialiser << data.magic;
|
||||
if (data.magic != ReplayMagic)
|
||||
if (data.magic != kReplayMagic)
|
||||
{
|
||||
LOG_ERROR("Magic does not match %08X, expected: %08X", data.magic, ReplayMagic);
|
||||
LOG_ERROR("Magic does not match %08X, expected: %08X", data.magic, kReplayMagic);
|
||||
return false;
|
||||
}
|
||||
serialiser << data.version;
|
||||
if (data.version != ReplayVersion && !Compatible(data))
|
||||
if (data.version != kReplayVersion && !Compatible(data))
|
||||
{
|
||||
LOG_ERROR("Invalid version detected %04X, expected: %04X", data.version, ReplayVersion);
|
||||
LOG_ERROR("Invalid version detected %04X, expected: %04X", data.version, kReplayVersion);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user