2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 00:27:42 +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:
Lioncash
2019-09-11 23:50:38 -04:00
parent d6166ad666
commit f9079f0215
42 changed files with 227 additions and 205 deletions

View File

@@ -384,7 +384,7 @@ void CWorldTransManager::EnableTransition(const CAnimRes& samusRes, CAssetId pla
x44_25_stopSoon = false;
x44_26_goingUp = goingUp;
x30_type = ETransType::Enabled;
x4_modelData.reset(new SModelDatas(samusRes));
x4_modelData = std::make_unique<SModelDatas>(samusRes);
if (!m_reflectionCube[0] && hecl::com_cubemaps->toBoolean())
CGraphics::CommitResources([this](boo::IGraphicsDataFactory::Context& ctx) {
@@ -437,11 +437,9 @@ void CWorldTransManager::EnableTransition(CAssetId fontId, CAssetId stringId, u3
x4_modelData.reset();
x44_27_fadeWhite = fadeWhite;
CGuiTextProperties props(false, true, EJustification::Center, EVerticalJustification::Center);
x8_textData.reset(new CGuiTextSupport(fontId, props, zeus::skWhite, zeus::skBlack,
zeus::skWhite, 640, 448, g_SimplePool,
CGuiWidget::EGuiModelDrawFlags::Additive));
const CGuiTextProperties props(false, true, EJustification::Center, EVerticalJustification::Center);
x8_textData = std::make_unique<CGuiTextSupport>(fontId, props, zeus::skWhite, zeus::skBlack, zeus::skWhite, 640, 448,
g_SimplePool, CGuiWidget::EGuiModelDrawFlags::Additive);
x8_textData->SetTypeWriteEffectOptions(true, chFadeTime, chFadeRate);
xc_strTable = g_SimplePool->GetObj(SObjectTag{FOURCC('STRG'), stringId});
x8_textData->SetText(u"");