mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-08 22: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:
@@ -125,12 +125,12 @@ CScriptGunTurret::CScriptGunTurret(TUniqueId uid, std::string_view name, ETurret
|
||||
, x44c_panningEffectDesc(g_SimplePool->GetObj({SBIG('PART'), turretData.GetPanningEffectRes()})) {
|
||||
if (turretData.GetVisorEffectRes().IsValid())
|
||||
x458_visorEffectDesc = g_SimplePool->GetObj({SBIG('PART'), turretData.GetVisorEffectRes()});
|
||||
x468_idleLight.reset(new CElementGen(x410_idleLightDesc));
|
||||
x470_deactivateLight.reset(new CElementGen(x41c_deactivateLightDesc));
|
||||
x478_targettingLight.reset(new CElementGen(x428_targettingLightDesc));
|
||||
x480_frozenEffect.reset(new CElementGen(x434_frozenEffectDesc));
|
||||
x488_chargingEffect.reset(new CElementGen(x440_chargingEffectDesc));
|
||||
x490_panningEffect.reset(new CElementGen(x44c_panningEffectDesc));
|
||||
x468_idleLight = std::make_unique<CElementGen>(x410_idleLightDesc);
|
||||
x470_deactivateLight = std::make_unique<CElementGen>(x41c_deactivateLightDesc);
|
||||
x478_targettingLight = std::make_unique<CElementGen>(x428_targettingLightDesc);
|
||||
x480_frozenEffect = std::make_unique<CElementGen>(x434_frozenEffectDesc);
|
||||
x488_chargingEffect = std::make_unique<CElementGen>(x440_chargingEffectDesc);
|
||||
x490_panningEffect = std::make_unique<CElementGen>(x44c_panningEffectDesc);
|
||||
x4fc_extensionOffset = xf.origin;
|
||||
x514_lastFrontVector = xf.frontVector();
|
||||
x544_originalFrontVec = xf.frontVector();
|
||||
@@ -330,8 +330,7 @@ void CScriptGunTurret::SetupCollisionManager(CStateManager& mgr) {
|
||||
x508_gunSDKSeg, blastLCTR, 0.6f, 1.f, CJointCollisionDescription::EOrientationType::One, "Gun_SDK"sv, 1000.f));
|
||||
jointDescs.push_back(CJointCollisionDescription::SphereCollision(blastLCTR, 0.3f, "Blast_LCTR"sv, 1000.f));
|
||||
|
||||
x49c_collisionManager.reset(new CCollisionActorManager(mgr, GetUniqueId(), GetAreaIdAlways(), jointDescs, true));
|
||||
|
||||
x49c_collisionManager = std::make_unique<CCollisionActorManager>(mgr, GetUniqueId(), GetAreaIdAlways(), jointDescs, true);
|
||||
x49c_collisionManager->SetActive(mgr, GetActive());
|
||||
|
||||
for (int i = 0; i < x49c_collisionManager->GetNumCollisionActors(); ++i) {
|
||||
|
||||
Reference in New Issue
Block a user