CGameState: Remove use of const_cast

Same behavior, but nicer to read.
This commit is contained in:
Lioncash 2020-03-29 20:52:30 -04:00
parent 603942daaf
commit 24fe7ec499
2 changed files with 3 additions and 3 deletions

View File

@ -205,7 +205,7 @@ void CGameState::WriteBackupBuf() {
PutTo(w); PutTo(w);
} }
void CGameState::PutTo(CBitStreamWriter& writer) const { void CGameState::PutTo(CBitStreamWriter& writer) {
for (u32 i = 0; i < 128; i++) for (u32 i = 0; i < 128; i++)
writer.WriteEncoded(x0_[i], 8); writer.WriteEncoded(x0_[i], 8);
@ -227,7 +227,7 @@ void CGameState::PutTo(CBitStreamWriter& writer) const {
for (const auto& memWorld : memWorlds) { for (const auto& memWorld : memWorlds) {
TLockedToken<CSaveWorld> saveWorld = TLockedToken<CSaveWorld> saveWorld =
g_SimplePool->GetObj(SObjectTag{FOURCC('SAVW'), memWorld.second.GetSaveWorldAssetId()}); g_SimplePool->GetObj(SObjectTag{FOURCC('SAVW'), memWorld.second.GetSaveWorldAssetId()});
const CWorldState& wld = const_cast<CGameState&>(*this).StateForWorld(memWorld.first); const CWorldState& wld = StateForWorld(memWorld.first);
wld.PutTo(writer, *saveWorld); wld.PutTo(writer, *saveWorld);
} }
} }

View File

@ -116,7 +116,7 @@ public:
void SetFileIdx(u32 idx) { x20c_saveFileIdx = idx; } void SetFileIdx(u32 idx) { x20c_saveFileIdx = idx; }
void SetCardSerial(u64 serial) { x210_cardSerial = serial; } void SetCardSerial(u64 serial) { x210_cardSerial = serial; }
u64 GetCardSerial() const { return x210_cardSerial; } u64 GetCardSerial() const { return x210_cardSerial; }
void PutTo(CBitStreamWriter& writer) const; void PutTo(CBitStreamWriter& writer);
float GetHardModeDamageMultiplier() const; float GetHardModeDamageMultiplier() const;
float GetHardModeWeaponMultiplier() const; float GetHardModeWeaponMultiplier() const;
void InitializeMemoryWorlds(); void InitializeMemoryWorlds();