2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 00:27:42 +00:00

Runtime: Use nullptr where applicable

Same behavior, but no magic 0 value.

While we're in the same area, we can do minor cosmetic changes.
This commit is contained in:
Lioncash
2020-03-27 20:11:51 -04:00
parent e0fe365dfd
commit 194cdf145f
6 changed files with 34 additions and 29 deletions

View File

@@ -1013,15 +1013,18 @@ CEntity* ScriptLoader::LoadBeetle(CStateManager& mgr, CInputStream& in, int prop
}
CEntity* ScriptLoader::LoadHUDMemo(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info) {
if (propCount != 5 && !EnsurePropertyCount(propCount, 6, "HUDMemo"))
return 0;
std::string name = mgr.HashInstanceName(in);
CHUDMemoParms hParms(in);
CScriptHUDMemo::EDisplayType displayType = CScriptHUDMemo::EDisplayType::MessageBox;
if (propCount == 6)
if (propCount != 5 && !EnsurePropertyCount(propCount, 6, "HUDMemo")) {
return nullptr;
}
const std::string name = mgr.HashInstanceName(in);
const CHUDMemoParms hParms(in);
auto displayType = CScriptHUDMemo::EDisplayType::MessageBox;
if (propCount == 6) {
displayType = CScriptHUDMemo::EDisplayType(in.readUint32Big());
CAssetId message = in.readUint32Big();
bool active = in.readBool();
}
const CAssetId message = in.readUint32Big();
const bool active = in.readBool();
return new CScriptHUDMemo(mgr.AllocateUniqueId(), name, info, hParms, displayType, message, active);
}