mirror of https://github.com/AxioDL/metaforce.git
CIceSheegoth: Add missing reference ampersands to IsClosestSheegoth()
Same behavior, but doesn't make copies of the vector and reserved_vector (the reserved vector in particular is 2056 bytes in size and this function is called in a loop, so this can have quite an impact).
This commit is contained in:
parent
5f899b6c6c
commit
17ed0794e9
|
@ -1493,12 +1493,11 @@ bool CIceSheegoth::ShouldAttractProjectile(const CGameProjectile& proj, CStateMa
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CIceSheegoth::IsClosestSheegoth(CStateManager& mgr, rstl::reserved_vector<TUniqueId, 1024> nearList,
|
bool CIceSheegoth::IsClosestSheegoth(CStateManager& mgr, const rstl::reserved_vector<TUniqueId, 1024>& nearList,
|
||||||
zeus::CVector3f projectileOffset) const {
|
const zeus::CVector3f& projectileOffset) const {
|
||||||
|
|
||||||
zeus::CVector3f diff = projectileOffset - GetTranslation();
|
zeus::CVector3f diff = projectileOffset - GetTranslation();
|
||||||
const float diffMag = diff.magSquared();
|
const float diffMag = diff.magSquared();
|
||||||
for (TUniqueId uid : nearList) {
|
for (const TUniqueId uid : nearList) {
|
||||||
const CIceSheegoth* goth = CPatterned::CastTo<CIceSheegoth>(mgr.GetObjectById(uid));
|
const CIceSheegoth* goth = CPatterned::CastTo<CIceSheegoth>(mgr.GetObjectById(uid));
|
||||||
if (!goth || goth->GetUniqueId() == GetUniqueId())
|
if (!goth || goth->GetUniqueId() == GetUniqueId())
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -186,8 +186,8 @@ class CIceSheegoth : public CPatterned {
|
||||||
void UpdateAttackPosition(CStateManager& mgr, zeus::CVector3f& attackPos);
|
void UpdateAttackPosition(CStateManager& mgr, zeus::CVector3f& attackPos);
|
||||||
zeus::CVector3f GetEnergyAttractionPos(CStateManager& mgr) const;
|
zeus::CVector3f GetEnergyAttractionPos(CStateManager& mgr) const;
|
||||||
bool ShouldAttractProjectile(const CGameProjectile& proj, CStateManager& mgr) const;
|
bool ShouldAttractProjectile(const CGameProjectile& proj, CStateManager& mgr) const;
|
||||||
bool IsClosestSheegoth(CStateManager& mgr, const rstl::reserved_vector<TUniqueId, 1024> nearList,
|
bool IsClosestSheegoth(CStateManager& mgr, const rstl::reserved_vector<TUniqueId, 1024>& nearList,
|
||||||
const zeus::CVector3f projectileOffset) const;
|
const zeus::CVector3f& projectileOffset) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DEFINE_PATTERNED(IceSheeegoth);
|
DEFINE_PATTERNED(IceSheeegoth);
|
||||||
|
|
Loading…
Reference in New Issue