diff --git a/Runtime/Character/CPASAnimState.cpp b/Runtime/Character/CPASAnimState.cpp index 8089601ea..3bde8b003 100644 --- a/Runtime/Character/CPASAnimState.cpp +++ b/Runtime/Character/CPASAnimState.cpp @@ -60,14 +60,15 @@ CPASAnimState::CPASAnimState(CInputStream& in) { CPASAnimState::CPASAnimState(int stateId) : x0_id(stateId) {} -CPASAnimParm CPASAnimState::GetAnimParmData(s32 animId, u32 parmIdx) const { - auto search = rstl::binary_find(x14_anims.begin(), x14_anims.end(), animId, - [](const CPASAnimInfo& item) { return item.GetAnimId(); }); - if (search == x14_anims.end()) +CPASAnimParm CPASAnimState::GetAnimParmData(s32 animId, size_t parmIdx) const { + const auto search = rstl::binary_find(x14_anims.cbegin(), x14_anims.cend(), animId, + [](const CPASAnimInfo& item) { return item.GetAnimId(); }); + if (search == x14_anims.cend()) { return CPASAnimParm::NoParameter(); + } - CPASParmInfo parm = x4_parms.at(parmIdx); - return (*search).GetAnimParmData(parmIdx, parm.GetParameterType()); + const CPASParmInfo& parm = x4_parms.at(parmIdx); + return search->GetAnimParmData(parmIdx, parm.GetParameterType()); } s32 CPASAnimState::PickRandomAnimation(CRandom16& rand) const { diff --git a/Runtime/Character/CPASAnimState.hpp b/Runtime/Character/CPASAnimState.hpp index 3874a32dc..375ba5257 100644 --- a/Runtime/Character/CPASAnimState.hpp +++ b/Runtime/Character/CPASAnimState.hpp @@ -27,7 +27,7 @@ public: explicit CPASAnimState(int stateId); s32 GetStateId() const { return x0_id; } s32 GetNumAnims() const { return x14_anims.size(); } - CPASAnimParm GetAnimParmData(s32 animId, u32 parmIdx) const; + CPASAnimParm GetAnimParmData(s32 animId, size_t parmIdx) const; std::pair FindBestAnimation(const rstl::reserved_vector& parms, CRandom16& rand, s32 ignoreAnim) const; };