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

General: Mark a handful of deduced const variables as const explicitly

Same behavior, but makes it explicit to the reader that these are const.

Prevents cases where the reader might assume that just because the
variable isn't const qualified that it must be mutable, when it actually
isn't.
This commit is contained in:
Lioncash
2020-05-08 18:41:27 -04:00
parent 6658be66c2
commit 5d209c8dc8
12 changed files with 47 additions and 35 deletions

View File

@@ -326,16 +326,20 @@ void CAuxWeapon::RenderMuzzleFx() const {
}
TUniqueId CAuxWeapon::HasTarget(const CStateManager& mgr) const {
if (x74_firingBeamId == CPlayerState::EBeamId::Wave)
if (auto* wb = static_cast<const CWaveBuster*>(mgr.GetObjectById(x70_waveBusterId)))
if (x74_firingBeamId == CPlayerState::EBeamId::Wave) {
if (const auto* wb = static_cast<const CWaveBuster*>(mgr.GetObjectById(x70_waveBusterId))) {
return wb->GetHomingTargetId();
}
}
return kInvalidUniqueId;
}
void CAuxWeapon::SetNewTarget(TUniqueId targetId, CStateManager& mgr) {
if (x74_firingBeamId == CPlayerState::EBeamId::Wave)
if (auto* wb = static_cast<CWaveBuster*>(mgr.ObjectById(x70_waveBusterId)))
if (x74_firingBeamId == CPlayerState::EBeamId::Wave) {
if (auto* wb = static_cast<CWaveBuster*>(mgr.ObjectById(x70_waveBusterId))) {
wb->SetNewTarget(targetId);
}
}
}
} // namespace urde