2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-15 22:57:02 +00:00

RuntimeCommon: Use const on member functions where applicable

Adds missing const qualifiers on class member functions that don't
modify instance state.
This commit is contained in:
Lioncash
2019-08-14 06:04:11 -04:00
parent cf294db9eb
commit d3d629d405
91 changed files with 269 additions and 248 deletions

View File

@@ -164,16 +164,16 @@ void CJellyZap::RemoveSelfFromFishCloud(CStateManager&) {}
void CJellyZap::RemoveAllAttractors(CStateManager& mgr) { RemoveSelfFromFishCloud(mgr); }
bool CJellyZap::ClosestToPlayer(CStateManager& mgr) {
zeus::CVector3f playerPos = mgr.GetPlayer().GetTranslation();
float ourDistance = (playerPos - GetTranslation()).magnitude();
bool CJellyZap::ClosestToPlayer(const CStateManager& mgr) const {
const zeus::CVector3f playerPos = mgr.GetPlayer().GetTranslation();
const float ourDistance = (playerPos - GetTranslation()).magnitude();
float closestDistance = ourDistance;
for (CEntity* ent : mgr.GetPhysicsActorObjectList()) {
if (CJellyZap* zap = CPatterned::CastTo<CJellyZap>(ent)) {
if (zap->GetAreaIdAlways() != GetAreaIdAlways())
continue;
float tmpDist = (playerPos - zap->GetTranslation()).magnitude();
const float tmpDist = (playerPos - zap->GetTranslation()).magnitude();
if (tmpDist < closestDistance)
closestDistance = tmpDist;