2
0
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:
Lioncash
2019-09-11 23:50:38 -04:00
parent d6166ad666
commit f9079f0215
42 changed files with 227 additions and 205 deletions

View File

@@ -13,7 +13,7 @@ COBBTree::COBBTree(CInputStream& in)
, x4_version(verify_version(in))
, x8_memsize(in.readUint32())
, x18_indexData(in)
, x88_root(new CNode(in)) {}
, x88_root(std::make_unique<CNode>(in)) {}
static const u8 DefaultEdgeMaterials[] = {
2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 2, 0, 0, 2, 0, 0, 2, 2
@@ -168,10 +168,10 @@ COBBTree::CNode::CNode(CInputStream& in) {
x0_obb = zeus::COBBox::ReadBig(in);
x3c_isLeaf = in.readBool();
if (x3c_isLeaf)
x48_leaf.reset(new CLeafData(in));
x48_leaf = std::make_unique<CLeafData>(in);
else {
x40_left.reset(new CNode(in));
x44_right.reset(new CNode(in));
x40_left = std::make_unique<CNode>(in);
x44_right = std::make_unique<CNode>(in);
}
}