CGameState: Make use of std::array where applicable

This commit is contained in:
Lioncash 2020-03-29 20:54:29 -04:00
parent 24fe7ec499
commit 45ea19040d
2 changed files with 8 additions and 5 deletions

View File

@ -143,8 +143,9 @@ CGameState::CGameState(CBitStreamReader& stream, u32 saveIdx) : x20c_saveFileIdx
x9c_transManager = std::make_shared<CWorldTransManager>(); x9c_transManager = std::make_shared<CWorldTransManager>();
x228_25_initPowerupsAtFirstSpawn = true; x228_25_initPowerupsAtFirstSpawn = true;
for (u32 i = 0; i < 128; i++) for (bool& value : x0_) {
x0_[i] = stream.ReadEncoded(8); value = stream.ReadEncoded(8) != 0;
}
stream.ReadEncoded(32); stream.ReadEncoded(32);
x228_24_hardMode = stream.ReadEncoded(1); x228_24_hardMode = stream.ReadEncoded(1);
@ -206,8 +207,9 @@ void CGameState::WriteBackupBuf() {
} }
void CGameState::PutTo(CBitStreamWriter& writer) { void CGameState::PutTo(CBitStreamWriter& writer) {
for (u32 i = 0; i < 128; i++) for (const bool value : x0_) {
writer.WriteEncoded(x0_[i], 8); writer.WriteEncoded(u32(value), 8);
}
writer.WriteEncoded(CBasics::ToWiiTime(std::chrono::system_clock::now()) / CBasics::TICKS_PER_SECOND, 32); writer.WriteEncoded(CBasics::ToWiiTime(std::chrono::system_clock::now()) / CBasics::TICKS_PER_SECOND, 32);
writer.WriteEncoded(x228_24_hardMode, 1); writer.WriteEncoded(x228_24_hardMode, 1);

View File

@ -1,5 +1,6 @@
#pragma once #pragma once
#include <array>
#include <memory> #include <memory>
#include <vector> #include <vector>
@ -67,7 +68,7 @@ public:
class CGameState { class CGameState {
friend class CStateManager; friend class CStateManager;
bool x0_[128] = {}; std::array<bool, 128> x0_{};
u32 x80_; u32 x80_;
CAssetId x84_mlvlId; CAssetId x84_mlvlId;
std::vector<CWorldState> x88_worldStates; std::vector<CWorldState> x88_worldStates;