From 061b7f9a986b2f86e366caaa0cadf01e02eeb191 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Thu, 9 Apr 2020 20:32:35 -0400 Subject: [PATCH] CCollisionActorManager: Remove usage of const_cast We can just make Destroy() a non-const member function to eliminate the need for this cast. --- Runtime/Collision/CCollisionActorManager.cpp | 4 ++-- Runtime/Collision/CCollisionActorManager.hpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Runtime/Collision/CCollisionActorManager.cpp b/Runtime/Collision/CCollisionActorManager.cpp index 963546c4e..81b8b6d35 100644 --- a/Runtime/Collision/CCollisionActorManager.cpp +++ b/Runtime/Collision/CCollisionActorManager.cpp @@ -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) { mgr.FreeScriptObject(desc.GetCollisionActorId()); } - const_cast(*this).x13_destroyed = true; + x13_destroyed = true; } void CCollisionActorManager::SetActive(CStateManager& mgr, bool active) { diff --git a/Runtime/Collision/CCollisionActorManager.hpp b/Runtime/Collision/CCollisionActorManager.hpp index 5e78946ae..158632851 100644 --- a/Runtime/Collision/CCollisionActorManager.hpp +++ b/Runtime/Collision/CCollisionActorManager.hpp @@ -30,8 +30,8 @@ public: CCollisionActorManager(CStateManager& mgr, TUniqueId owner, TAreaId area, const std::vector& descs, bool active); - void Update(float dt, CStateManager& mgr, CCollisionActorManager::EUpdateOptions opts); - void Destroy(CStateManager& mgr) const; + void Update(float dt, CStateManager& mgr, EUpdateOptions opts); + void Destroy(CStateManager& mgr); void SetActive(CStateManager& mgr, bool active); bool GetActive() const { return x12_active; } void AddMaterial(CStateManager& mgr, const CMaterialList& list);