mirror of https://github.com/AxioDL/metaforce.git
CGameState: Silence implicit truncation warnings
Ensures boolean conditions are used where applicable.
This commit is contained in:
parent
f844f2028b
commit
a551dbc21d
|
@ -24,15 +24,16 @@ union BitsToDouble {
|
||||||
};
|
};
|
||||||
|
|
||||||
CWorldLayerState::CWorldLayerState(CBitStreamReader& reader, const CSaveWorld& saveWorld) {
|
CWorldLayerState::CWorldLayerState(CBitStreamReader& reader, const CSaveWorld& saveWorld) {
|
||||||
u32 bitCount = reader.ReadEncoded(10);
|
const u32 bitCount = reader.ReadEncoded(10);
|
||||||
x10_saveLayers.reserve(bitCount);
|
x10_saveLayers.reserve(bitCount);
|
||||||
|
|
||||||
for (u32 i = 0; i < bitCount; ++i) {
|
for (u32 i = 0; i < bitCount; ++i) {
|
||||||
bool bit = reader.ReadEncoded(1);
|
const bool bit = reader.ReadEncoded(1) != 0;
|
||||||
if (bit)
|
if (bit) {
|
||||||
x10_saveLayers.setBit(i);
|
x10_saveLayers.setBit(i);
|
||||||
else
|
} else {
|
||||||
x10_saveLayers.unsetBit(i);
|
x10_saveLayers.unsetBit(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,11 +54,14 @@ void CWorldLayerState::PutTo(CBitStreamWriter& writer) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWorldLayerState::InitializeWorldLayers(const std::vector<CWorldLayers::Area>& layers) {
|
void CWorldLayerState::InitializeWorldLayers(const std::vector<CWorldLayers::Area>& layers) {
|
||||||
if (x0_areaLayers.size())
|
if (!x0_areaLayers.empty()) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
x0_areaLayers = layers;
|
x0_areaLayers = layers;
|
||||||
if (x10_saveLayers.getBitCount() == 0)
|
if (x10_saveLayers.getBitCount() == 0) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
u32 a = 0;
|
u32 a = 0;
|
||||||
u32 b = 0;
|
u32 b = 0;
|
||||||
|
@ -102,9 +106,9 @@ CGameState::GameFileStateInfo CGameState::LoadGameFileState(const u8* data) {
|
||||||
}
|
}
|
||||||
ret.x14_timestamp = stream.ReadEncoded(32);
|
ret.x14_timestamp = stream.ReadEncoded(32);
|
||||||
|
|
||||||
ret.x20_hardMode = stream.ReadEncoded(1);
|
ret.x20_hardMode = stream.ReadEncoded(1) != 0;
|
||||||
stream.ReadEncoded(1);
|
stream.ReadEncoded(1);
|
||||||
CAssetId origMLVL = u32(stream.ReadEncoded(32));
|
const CAssetId origMLVL = u32(stream.ReadEncoded(32));
|
||||||
ret.x8_mlvlId = origMLVL;
|
ret.x8_mlvlId = origMLVL;
|
||||||
|
|
||||||
BitsToDouble conv;
|
BitsToDouble conv;
|
||||||
|
@ -139,8 +143,10 @@ CGameState::CGameState() {
|
||||||
x9c_transManager = std::make_shared<CWorldTransManager>();
|
x9c_transManager = std::make_shared<CWorldTransManager>();
|
||||||
x228_24_hardMode = false;
|
x228_24_hardMode = false;
|
||||||
x228_25_initPowerupsAtFirstSpawn = true;
|
x228_25_initPowerupsAtFirstSpawn = true;
|
||||||
if (g_MemoryCardSys)
|
|
||||||
|
if (g_MemoryCardSys != nullptr) {
|
||||||
InitializeMemoryStates();
|
InitializeMemoryStates();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CGameState::CGameState(CBitStreamReader& stream, u32 saveIdx) : x20c_saveFileIdx(saveIdx) {
|
CGameState::CGameState(CBitStreamReader& stream, u32 saveIdx) : x20c_saveFileIdx(saveIdx) {
|
||||||
|
@ -153,8 +159,8 @@ CGameState::CGameState(CBitStreamReader& stream, u32 saveIdx) : x20c_saveFileIdx
|
||||||
}
|
}
|
||||||
stream.ReadEncoded(32);
|
stream.ReadEncoded(32);
|
||||||
|
|
||||||
x228_24_hardMode = stream.ReadEncoded(1);
|
x228_24_hardMode = stream.ReadEncoded(1) != 0;
|
||||||
x228_25_initPowerupsAtFirstSpawn = stream.ReadEncoded(1);
|
x228_25_initPowerupsAtFirstSpawn = stream.ReadEncoded(1) != 0;
|
||||||
x84_mlvlId = u32(stream.ReadEncoded(32));
|
x84_mlvlId = u32(stream.ReadEncoded(32));
|
||||||
MP1::CMain::EnsureWorldPakReady(x84_mlvlId);
|
MP1::CMain::EnsureWorldPakReady(x84_mlvlId);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue