2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-11 21:44:00 +00:00

RetroDataSpec: Make use of make_unique where applicable

Same behavior, but without a mildly wonky way of performing it.
This commit is contained in:
Lioncash
2020-03-31 12:50:26 -04:00
parent 53694481e5
commit 9ef2fbba5a
9 changed files with 82 additions and 77 deletions

View File

@@ -99,15 +99,18 @@ void DCLN::Collision::Node::Enumerate(typename Op::StreamT& s) {
Do<Op>(athena::io::PropId{"halfExtent"}, halfExtent, s);
Do<Op>(athena::io::PropId{"isLeaf"}, isLeaf, s);
if (isLeaf) {
if (!leafData)
leafData.reset(new LeafData);
if (!leafData) {
leafData = std::make_unique<LeafData>();
}
Do<Op>(athena::io::PropId{"leafData"}, *leafData, s);
} else {
if (!left)
left.reset(new Node);
if (!left) {
left = std::make_unique<Node>();
}
Do<Op>(athena::io::PropId{"left"}, *left, s);
if (!right)
right.reset(new Node);
if (!right) {
right = std::make_unique<Node>();
}
Do<Op>(athena::io::PropId{"right"}, *right, s);
}
}