mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-08 13:44:56 +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:
@@ -567,8 +567,8 @@ void CElementGen::UpdatePSTranslationAndOrientation() {
|
||||
}
|
||||
|
||||
std::unique_ptr<CParticleGen> CElementGen::ConstructChildParticleSystem(const TToken<CGenDescription>& desc) const {
|
||||
CElementGen* ret = new CElementGen(desc, EModelOrientationType::Normal,
|
||||
x26d_27_enableOPTS ? EOptionalSystemFlags::Two : EOptionalSystemFlags::One);
|
||||
auto ret = std::make_unique<CElementGen>(desc, EModelOrientationType::Normal,
|
||||
x26d_27_enableOPTS ? EOptionalSystemFlags::Two : EOptionalSystemFlags::One);
|
||||
ret->x26d_26_modelsUseLights = x26d_26_modelsUseLights;
|
||||
ret->SetGlobalTranslation(xe8_globalTranslation);
|
||||
ret->SetGlobalOrientation(x22c_globalOrientation);
|
||||
@@ -578,7 +578,7 @@ std::unique_ptr<CParticleGen> CElementGen::ConstructChildParticleSystem(const TT
|
||||
ret->SetOrientation(x1d8_orientation);
|
||||
ret->SetParticleEmission(x88_particleEmission);
|
||||
ret->SetModulationColor(x338_moduColor);
|
||||
return std::unique_ptr<CParticleGen>(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void CElementGen::UpdateChildParticleSystems(double dt) {
|
||||
|
||||
@@ -761,7 +761,7 @@ bool CParticleDataFactory::CreateGPSM(CGenDescription* fillDesc, CInputStream& i
|
||||
FourCC cid = GetClassID(in);
|
||||
if (cid != SBIG('CNST'))
|
||||
break;
|
||||
fillDesc->xd0_xbc_KSSM.reset(new CSpawnSystemKeyframeData(in));
|
||||
fillDesc->xd0_xbc_KSSM = std::make_unique<CSpawnSystemKeyframeData>(in);
|
||||
fillDesc->xd0_xbc_KSSM->LoadAllSpawnedSystemTokens(resPool);
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user