CTeamAiMgr: Make reference parameters to GetTeamAiMgr() const

No modifications to these parameters are being made, so we can make that
explicit in the interface.
This commit is contained in:
Lioncash 2020-05-02 22:39:49 -04:00
parent 21a33b01ad
commit d0233b7767
2 changed files with 5 additions and 4 deletions

View File

@ -361,14 +361,15 @@ bool CTeamAiMgr::AddAttacker(EAttackType type, CStateManager& mgr, TUniqueId mgr
return false; return false;
} }
TUniqueId CTeamAiMgr::GetTeamAiMgr(CAi& ai, CStateManager& mgr) { TUniqueId CTeamAiMgr::GetTeamAiMgr(const CAi& ai, const CStateManager& mgr) {
for (const auto& conn : ai.GetConnectionList()) { for (const auto& conn : ai.GetConnectionList()) {
if (conn.x0_state == EScriptObjectState::Active && conn.x4_msg == EScriptObjectMessage::Play) { if (conn.x0_state == EScriptObjectState::Active && conn.x4_msg == EScriptObjectMessage::Play) {
TUniqueId id = mgr.GetIdForScript(conn.x8_objId); const TUniqueId id = mgr.GetIdForScript(conn.x8_objId);
if (TCastToConstPtr<CTeamAiMgr> aimgr = mgr.GetObjectById(id)) if (const TCastToConstPtr<CTeamAiMgr> aimgr = mgr.GetObjectById(id)) {
return aimgr->GetUniqueId(); return aimgr->GetUniqueId();
} }
} }
}
return kInvalidUniqueId; return kInvalidUniqueId;
} }

View File

@ -114,6 +114,6 @@ public:
static bool CanAcceptAttacker(EAttackType type, CStateManager& mgr, TUniqueId mgrId, TUniqueId aiId); static bool CanAcceptAttacker(EAttackType type, CStateManager& mgr, TUniqueId mgrId, TUniqueId aiId);
static bool AddAttacker(EAttackType type, CStateManager& mgr, TUniqueId mgrId, TUniqueId aiId); static bool AddAttacker(EAttackType type, CStateManager& mgr, TUniqueId mgrId, TUniqueId aiId);
static TUniqueId GetTeamAiMgr(CAi& ai, CStateManager& mgr); static TUniqueId GetTeamAiMgr(const CAi& ai, const CStateManager& mgr);
}; };
} // namespace urde } // namespace urde