From 24fe7ec499f2ff4ed10fd5cdb0cd9e69a945a296 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 29 Mar 2020 20:52:30 -0400 Subject: [PATCH] CGameState: Remove use of const_cast Same behavior, but nicer to read. --- Runtime/CGameState.cpp | 4 ++-- Runtime/CGameState.hpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Runtime/CGameState.cpp b/Runtime/CGameState.cpp index d15b41bed..92d312eb8 100644 --- a/Runtime/CGameState.cpp +++ b/Runtime/CGameState.cpp @@ -205,7 +205,7 @@ void CGameState::WriteBackupBuf() { PutTo(w); } -void CGameState::PutTo(CBitStreamWriter& writer) const { +void CGameState::PutTo(CBitStreamWriter& writer) { for (u32 i = 0; i < 128; i++) writer.WriteEncoded(x0_[i], 8); @@ -227,7 +227,7 @@ void CGameState::PutTo(CBitStreamWriter& writer) const { for (const auto& memWorld : memWorlds) { TLockedToken saveWorld = g_SimplePool->GetObj(SObjectTag{FOURCC('SAVW'), memWorld.second.GetSaveWorldAssetId()}); - const CWorldState& wld = const_cast(*this).StateForWorld(memWorld.first); + const CWorldState& wld = StateForWorld(memWorld.first); wld.PutTo(writer, *saveWorld); } } diff --git a/Runtime/CGameState.hpp b/Runtime/CGameState.hpp index 5790af0d9..1c954fddf 100644 --- a/Runtime/CGameState.hpp +++ b/Runtime/CGameState.hpp @@ -116,7 +116,7 @@ public: void SetFileIdx(u32 idx) { x20c_saveFileIdx = idx; } void SetCardSerial(u64 serial) { x210_cardSerial = serial; } u64 GetCardSerial() const { return x210_cardSerial; } - void PutTo(CBitStreamWriter& writer) const; + void PutTo(CBitStreamWriter& writer); float GetHardModeDamageMultiplier() const; float GetHardModeWeaponMultiplier() const; void InitializeMemoryWorlds();