From bfea80fc4ac086ad74b8ba22b0e2ae64213eb5ad Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 12 Apr 2020 11:05:54 -0400 Subject: [PATCH] CBabygoth: Mark IsDestinationObstructed() as const This doesn't alter class state, so we can mark it as const. --- Runtime/MP1/World/CBabygoth.cpp | 9 +++++---- Runtime/MP1/World/CBabygoth.hpp | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Runtime/MP1/World/CBabygoth.cpp b/Runtime/MP1/World/CBabygoth.cpp index d021b159d..12c1d1aeb 100644 --- a/Runtime/MP1/World/CBabygoth.cpp +++ b/Runtime/MP1/World/CBabygoth.cpp @@ -1103,12 +1103,13 @@ bool CBabygoth::Leash(CStateManager& mgr, float) { return false; } -bool CBabygoth::IsDestinationObstructed(CStateManager& mgr) { - for (CEntity* obj : mgr.GetListeningAiObjectList()) { - if (TCastToPtr ai = obj) { +bool CBabygoth::IsDestinationObstructed(const CStateManager& mgr) const { + for (const CEntity* obj : mgr.GetListeningAiObjectList()) { + if (const TCastToConstPtr ai = obj) { if (ai->GetAreaIdAlways() == GetAreaIdAlways()) { - if ((x8b8_backupDestPos - ai->GetTranslation()).magSquared() <= 10.f) + if ((x8b8_backupDestPos - ai->GetTranslation()).magSquared() <= 10.f) { return true; + } } } } diff --git a/Runtime/MP1/World/CBabygoth.hpp b/Runtime/MP1/World/CBabygoth.hpp index 0a8159faf..fec7ec593 100644 --- a/Runtime/MP1/World/CBabygoth.hpp +++ b/Runtime/MP1/World/CBabygoth.hpp @@ -160,7 +160,7 @@ private: void UpdateShellHealth(CStateManager&); - bool IsDestinationObstructed(CStateManager&); + bool IsDestinationObstructed(const CStateManager& mgr) const; void DestroyShell(CStateManager& mgr);