CCollisionActorManager: Remove usage of const_cast

We can just make Destroy() a non-const member function to eliminate the
need for this cast.
This commit is contained in:
Lioncash 2020-04-09 20:32:35 -04:00
parent e22ecf644d
commit 061b7f9a98
2 changed files with 4 additions and 4 deletions

View File

@ -122,12 +122,12 @@ CCollisionActorManager::CCollisionActorManager(CStateManager& mgr, TUniqueId own
} }
} }
void CCollisionActorManager::Destroy(CStateManager& mgr) const { void CCollisionActorManager::Destroy(CStateManager& mgr) {
for (const CJointCollisionDescription& desc : x0_jointDescriptions) { for (const CJointCollisionDescription& desc : x0_jointDescriptions) {
mgr.FreeScriptObject(desc.GetCollisionActorId()); mgr.FreeScriptObject(desc.GetCollisionActorId());
} }
const_cast<CCollisionActorManager&>(*this).x13_destroyed = true; x13_destroyed = true;
} }
void CCollisionActorManager::SetActive(CStateManager& mgr, bool active) { void CCollisionActorManager::SetActive(CStateManager& mgr, bool active) {

View File

@ -30,8 +30,8 @@ public:
CCollisionActorManager(CStateManager& mgr, TUniqueId owner, TAreaId area, CCollisionActorManager(CStateManager& mgr, TUniqueId owner, TAreaId area,
const std::vector<CJointCollisionDescription>& descs, bool active); const std::vector<CJointCollisionDescription>& descs, bool active);
void Update(float dt, CStateManager& mgr, CCollisionActorManager::EUpdateOptions opts); void Update(float dt, CStateManager& mgr, EUpdateOptions opts);
void Destroy(CStateManager& mgr) const; void Destroy(CStateManager& mgr);
void SetActive(CStateManager& mgr, bool active); void SetActive(CStateManager& mgr, bool active);
bool GetActive() const { return x12_active; } bool GetActive() const { return x12_active; }
void AddMaterial(CStateManager& mgr, const CMaterialList& list); void AddMaterial(CStateManager& mgr, const CMaterialList& list);