mirror of https://github.com/AxioDL/metaforce.git
CPASAnimState: Make use of size_t for GetAnimParmData()
Given the rest of the interface now uses size_t, we can convert this over. While we're at it, we can also take the result of the at() call inside of it in order to avoid any copies of data altogether.
This commit is contained in:
parent
17c1582ba2
commit
6381f021b7
|
@ -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,
|
||||
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.end())
|
||||
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 {
|
||||
|
|
|
@ -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<float, s32> FindBestAnimation(const rstl::reserved_vector<CPASAnimParm, 8>& parms, CRandom16& rand,
|
||||
s32 ignoreAnim) const;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue