mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-09 15:07:41 +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:
@@ -15,9 +15,9 @@ CElectricBeamProjectile::CElectricBeamProjectile(const TToken<CWeaponDescription
|
||||
TAreaId areaId, TUniqueId owner, EProjectileAttrib attribs)
|
||||
: CBeamProjectile(wDesc, "ElectricBeamProjectile"sv, wType, xf, u32(elec.x8_maxLength), elec.xc_radius,
|
||||
elec.x10_travelSpeed, matTypes, dInfo, uid, areaId, owner, attribs, false)
|
||||
, x468_electric(new CParticleElectric(elec.x0_electricDescription))
|
||||
, x468_electric(std::make_unique<CParticleElectric>(elec.x0_electricDescription))
|
||||
, x46c_genDescription(g_SimplePool->GetObj({SBIG('PART'), elec.x14_particleId}))
|
||||
, x478_elementGen(new CElementGen(x46c_genDescription))
|
||||
, x478_elementGen(std::make_unique<CElementGen>(x46c_genDescription))
|
||||
, x47c_(elec.x18_)
|
||||
, x488_(elec.x1c_) {
|
||||
x478_elementGen->SetParticleEmission(false);
|
||||
|
||||
Reference in New Issue
Block a user