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:
Lioncash 2020-06-11 10:27:58 -04:00
parent 5f899b6c6c
commit 17ed0794e9
2 changed files with 5 additions and 6 deletions

View File

@ -1493,12 +1493,11 @@ bool CIceSheegoth::ShouldAttractProjectile(const CGameProjectile& proj, CStateMa
return false;
}
bool CIceSheegoth::IsClosestSheegoth(CStateManager& mgr, rstl::reserved_vector<TUniqueId, 1024> nearList,
zeus::CVector3f projectileOffset) const {
bool CIceSheegoth::IsClosestSheegoth(CStateManager& mgr, const rstl::reserved_vector<TUniqueId, 1024>& nearList,
const zeus::CVector3f& projectileOffset) const {
zeus::CVector3f diff = projectileOffset - GetTranslation();
const float diffMag = diff.magSquared();
for (TUniqueId uid : nearList) {
for (const TUniqueId uid : nearList) {
const CIceSheegoth* goth = CPatterned::CastTo<CIceSheegoth>(mgr.GetObjectById(uid));
if (!goth || goth->GetUniqueId() == GetUniqueId())
continue;

View File

@ -186,8 +186,8 @@ class CIceSheegoth : public CPatterned {
void UpdateAttackPosition(CStateManager& mgr, zeus::CVector3f& attackPos);
zeus::CVector3f GetEnergyAttractionPos(CStateManager& mgr) const;
bool ShouldAttractProjectile(const CGameProjectile& proj, CStateManager& mgr) const;
bool IsClosestSheegoth(CStateManager& mgr, const rstl::reserved_vector<TUniqueId, 1024> nearList,
const zeus::CVector3f projectileOffset) const;
bool IsClosestSheegoth(CStateManager& mgr, const rstl::reserved_vector<TUniqueId, 1024>& nearList,
const zeus::CVector3f& projectileOffset) const;
public:
DEFINE_PATTERNED(IceSheeegoth);