mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-09 06:27:43 +00:00
Runtime: Make use of std::make_unique where applicable
Makes use of the C++14 make_unique allocation function to allocate class instances where applicable instead of a reset with a new operator within it. This doesn't touch cases where buffers are allocated, given make_unique would zero-initialize them.
This commit is contained in:
@@ -556,15 +556,14 @@ void CGroundMovement::MoveGroundCollider_New(CStateManager& mgr, CPhysicsActor&
|
||||
std::unique_ptr<CCollisionPrimitive> prim;
|
||||
if (usePrim->GetPrimType() == FOURCC('AABX')) {
|
||||
const CCollidableAABox& existingAABB = static_cast<const CCollidableAABox&>(*usePrim);
|
||||
prim.reset(
|
||||
new CCollidableAABox(zeus::CAABox(existingAABB.GetBox().min + 0.0001f, existingAABB.GetBox().max - 0.0001f),
|
||||
usePrim->GetMaterial()));
|
||||
prim = std::make_unique<CCollidableAABox>(
|
||||
zeus::CAABox(existingAABB.GetBox().min + 0.0001f, existingAABB.GetBox().max - 0.0001f), usePrim->GetMaterial());
|
||||
usePrim = prim.get();
|
||||
} else if (usePrim->GetPrimType() == FOURCC('SPHR')) {
|
||||
const CCollidableSphere& existingSphere = static_cast<const CCollidableSphere&>(*usePrim);
|
||||
prim.reset(new CCollidableSphere(
|
||||
prim = std::make_unique<CCollidableSphere>(
|
||||
zeus::CSphere(existingSphere.GetSphere().position, existingSphere.GetSphere().radius - 0.0001f),
|
||||
usePrim->GetMaterial()));
|
||||
usePrim->GetMaterial());
|
||||
usePrim = prim.get();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user