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

CBodyState: Eliminate usages of const_cast

This is clearly modifying the command, so we should allow for modifying
of command instances if necessary.
This commit is contained in:
Lioncash
2020-04-05 03:20:52 -04:00
parent 1fb28a03a3
commit 71e3fb1817
2 changed files with 16 additions and 5 deletions

View File

@@ -1120,12 +1120,14 @@ pas::EAnimationState CBSHurled::GetBodyStateTransition(float dt, CBodyController
if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::NextState)) {
return pas::EAnimationState::LieOnGround;
}
if (x18_curTime > 0.25f) {
if (const auto* cmd = static_cast<const CBCHurledCmd*>(bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled))) {
const_cast<CBCHurledCmd*>(cmd)->SetSkipLaunchState(true);
if (auto* cmd = static_cast<CBCHurledCmd*>(bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled))) {
cmd->SetSkipLaunchState(true);
return pas::EAnimationState::Hurled;
}
}
return pas::EAnimationState::Invalid;
}