CObjectList: Make IsQualified() a const member function

None of the implementations modify object instance state, so this can be
made const qualified.
This commit is contained in:
Lioncash 2020-03-06 04:36:24 -05:00
parent 2f9dd38bbe
commit 80e2e97dc4
4 changed files with 21 additions and 21 deletions

View File

@ -91,6 +91,6 @@ CEntity* CObjectList::GetValidObjectById(TUniqueId uid) {
return ent.entity;
}
bool CObjectList::IsQualified(const CEntity&) { return true; }
bool CObjectList::IsQualified(const CEntity&) const { return true; }
} // namespace urde

View File

@ -80,7 +80,7 @@ public:
CEntity* GetValidObjectById(TUniqueId uid);
s16 GetFirstObjectIndex() const { return x2008_firstId; }
s16 GetNextObjectIndex(s16 prev) const { return x0_list[prev].next; }
virtual bool IsQualified(const CEntity&);
virtual bool IsQualified(const CEntity&) const;
u16 size() const { return x200a_count; }
};

View File

@ -14,39 +14,39 @@ namespace urde {
CActorList::CActorList() : CObjectList(EGameObjectList::Actor) {}
bool CActorList::IsQualified(const CEntity& ent) { return TCastToConstPtr<CActor>(ent); }
bool CActorList::IsQualified(const CEntity& ent) const { return TCastToConstPtr<CActor>(ent); }
CPhysicsActorList::CPhysicsActorList() : CObjectList(EGameObjectList::PhysicsActor) {}
bool CPhysicsActorList::IsQualified(const CEntity& ent) { return TCastToConstPtr<CPhysicsActor>(ent); }
bool CPhysicsActorList::IsQualified(const CEntity& ent) const { return TCastToConstPtr<CPhysicsActor>(ent); }
CGameCameraList::CGameCameraList() : CObjectList(EGameObjectList::GameCamera) {}
bool CGameCameraList::IsQualified(const CEntity& ent) { return TCastToConstPtr<CGameCamera>(ent); }
bool CGameCameraList::IsQualified(const CEntity& ent) const { return TCastToConstPtr<CGameCamera>(ent); }
CListeningAiList::CListeningAiList() : CObjectList(EGameObjectList::ListeningAi) {}
bool CListeningAiList::IsQualified(const CEntity& ent) {
TCastToConstPtr<CAi> ai(ent);
bool CListeningAiList::IsQualified(const CEntity& ent) const {
const TCastToConstPtr<CAi> ai(ent);
return ai && ai->IsListening();
}
CAiWaypointList::CAiWaypointList() : CObjectList(EGameObjectList::AiWaypoint) {}
bool CAiWaypointList::IsQualified(const CEntity& ent) {
bool CAiWaypointList::IsQualified(const CEntity& ent) const {
return TCastToConstPtr<CScriptCoverPoint>(ent) || TCastToConstPtr<CScriptAiJumpPoint>(ent);
}
CPlatformAndDoorList::CPlatformAndDoorList() : CObjectList(EGameObjectList::PlatformAndDoor) {}
bool CPlatformAndDoorList::IsQualified(const CEntity& ent) { return IsDoor(ent) || IsPlatform(ent); }
bool CPlatformAndDoorList::IsQualified(const CEntity& ent) const { return IsDoor(ent) || IsPlatform(ent); }
bool CPlatformAndDoorList::IsDoor(const CEntity& ent) { return TCastToConstPtr<CScriptDoor>(ent); }
bool CPlatformAndDoorList::IsDoor(const CEntity& ent) const { return TCastToConstPtr<CScriptDoor>(ent); }
bool CPlatformAndDoorList::IsPlatform(const CEntity& ent) { return TCastToConstPtr<CScriptPlatform>(ent); }
bool CPlatformAndDoorList::IsPlatform(const CEntity& ent) const { return TCastToConstPtr<CScriptPlatform>(ent); }
CGameLightList::CGameLightList() : CObjectList(EGameObjectList::GameLight) {}
bool CGameLightList::IsQualified(const CEntity& lt) { return TCastToConstPtr<CGameLight>(lt); }
bool CGameLightList::IsQualified(const CEntity& lt) const { return TCastToConstPtr<CGameLight>(lt); }
} // namespace urde

View File

@ -8,47 +8,47 @@ class CActorList : public CObjectList {
public:
CActorList();
bool IsQualified(const CEntity&) override;
bool IsQualified(const CEntity&) const override;
};
class CPhysicsActorList : public CObjectList {
public:
CPhysicsActorList();
bool IsQualified(const CEntity&) override;
bool IsQualified(const CEntity&) const override;
};
class CGameCameraList : public CObjectList {
public:
CGameCameraList();
bool IsQualified(const CEntity&) override;
bool IsQualified(const CEntity&) const override;
};
class CListeningAiList : public CObjectList {
public:
CListeningAiList();
bool IsQualified(const CEntity&) override;
bool IsQualified(const CEntity&) const override;
};
class CAiWaypointList : public CObjectList {
public:
CAiWaypointList();
bool IsQualified(const CEntity&) override;
bool IsQualified(const CEntity&) const override;
};
class CPlatformAndDoorList : public CObjectList {
public:
CPlatformAndDoorList();
bool IsQualified(const CEntity&) override;
bool IsDoor(const CEntity&);
bool IsPlatform(const CEntity&);
bool IsQualified(const CEntity&) const override;
bool IsDoor(const CEntity&) const;
bool IsPlatform(const CEntity&) const;
};
class CGameLightList : public CObjectList {
public:
CGameLightList();
bool IsQualified(const CEntity&) override;
bool IsQualified(const CEntity&) const override;
};
} // namespace urde