diff --git a/Runtime/World/CAiFuncMap.cpp b/Runtime/World/CAiFuncMap.cpp index 3f1420d9a..3a3787076 100644 --- a/Runtime/World/CAiFuncMap.cpp +++ b/Runtime/World/CAiFuncMap.cpp @@ -134,15 +134,23 @@ CAiFuncMap::CAiFuncMap() { CAi::CreateFuncLookup(this); } -CAiStateFunc CAiFuncMap::GetStateFunc(const char* func) { - if (x0_stateFuncs.find(func) == x0_stateFuncs.end()) +CAiStateFunc CAiFuncMap::GetStateFunc(const char* func) const { + const auto iter = x0_stateFuncs.find(func); + + if (iter == x0_stateFuncs.cend()) { return nullptr; - return x0_stateFuncs[func]; + } + + return iter->second; } -CAiTriggerFunc CAiFuncMap::GetTriggerFunc(const char* func) { - if (x10_triggerFuncs.find(func) == x10_triggerFuncs.end()) +CAiTriggerFunc CAiFuncMap::GetTriggerFunc(const char* func) const { + const auto iter = x10_triggerFuncs.find(func); + + if (iter == x10_triggerFuncs.cend()) { return nullptr; - return x10_triggerFuncs[func]; + } + + return iter->second; } } // namespace urde diff --git a/Runtime/World/CAiFuncMap.hpp b/Runtime/World/CAiFuncMap.hpp index e5b6e4a77..e9a37f074 100644 --- a/Runtime/World/CAiFuncMap.hpp +++ b/Runtime/World/CAiFuncMap.hpp @@ -18,7 +18,7 @@ class CAiFuncMap { public: CAiFuncMap(); - CAiStateFunc GetStateFunc(const char*); - CAiTriggerFunc GetTriggerFunc(const char*); + CAiStateFunc GetStateFunc(const char*) const; + CAiTriggerFunc GetTriggerFunc(const char*) const; }; } // namespace urde