mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-08 16:24:55 +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:
@@ -130,11 +130,11 @@ void ANIM::Enumerate<BigDNA::Read>(typename Read::StreamT& reader) {
|
||||
atUint32 version = reader.readUint32Big();
|
||||
switch (version) {
|
||||
case 0:
|
||||
m_anim.reset(new struct ANIM0);
|
||||
m_anim = std::make_unique<ANIM0>();
|
||||
m_anim->read(reader);
|
||||
break;
|
||||
case 1:
|
||||
m_anim.reset(new struct ANIM1);
|
||||
m_anim = std::make_unique<ANIM1>();
|
||||
m_anim->read(reader);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -74,30 +74,30 @@ std::string_view CHAR::AnimationInfo::EVNT::SFXEvent::DNAType() {
|
||||
|
||||
template <>
|
||||
void CHAR::AnimationInfo::MetaAnimFactory::Enumerate<BigDNA::Read>(athena::io::IStreamReader& reader) {
|
||||
IMetaAnim::Type type(IMetaAnim::Type(reader.readUint32Big()));
|
||||
const auto type = IMetaAnim::Type(reader.readUint32Big());
|
||||
switch (type) {
|
||||
case IMetaAnim::Type::Primitive:
|
||||
m_anim.reset(new struct MetaAnimPrimitive);
|
||||
m_anim = std::make_unique<MetaAnimPrimitive>();
|
||||
m_anim->read(reader);
|
||||
break;
|
||||
case IMetaAnim::Type::Blend:
|
||||
m_anim.reset(new struct MetaAnimBlend);
|
||||
m_anim = std::make_unique<MetaAnimBlend>();
|
||||
m_anim->read(reader);
|
||||
break;
|
||||
case IMetaAnim::Type::PhaseBlend:
|
||||
m_anim.reset(new struct MetaAnimPhaseBlend);
|
||||
m_anim = std::make_unique<MetaAnimPhaseBlend>();
|
||||
m_anim->read(reader);
|
||||
break;
|
||||
case IMetaAnim::Type::Random:
|
||||
m_anim.reset(new struct MetaAnimRandom);
|
||||
m_anim = std::make_unique<MetaAnimRandom>();
|
||||
m_anim->read(reader);
|
||||
break;
|
||||
case IMetaAnim::Type::Sequence:
|
||||
m_anim.reset(new struct MetaAnimSequence);
|
||||
m_anim = std::make_unique<MetaAnimSequence>();
|
||||
m_anim->read(reader);
|
||||
break;
|
||||
default:
|
||||
m_anim.reset(nullptr);
|
||||
m_anim.reset();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -123,22 +123,22 @@ void CHAR::AnimationInfo::MetaAnimFactory::Enumerate<BigDNA::ReadYaml>(athena::i
|
||||
std::string type = reader.readString("type");
|
||||
std::transform(type.begin(), type.end(), type.begin(), tolower);
|
||||
if (type == "primitive") {
|
||||
m_anim.reset(new struct MetaAnimPrimitive);
|
||||
m_anim = std::make_unique<MetaAnimPrimitive>();
|
||||
m_anim->read(reader);
|
||||
} else if (type == "blend") {
|
||||
m_anim.reset(new struct MetaAnimBlend);
|
||||
m_anim = std::make_unique<MetaAnimBlend>();
|
||||
m_anim->read(reader);
|
||||
} else if (type == "phaseblend") {
|
||||
m_anim.reset(new struct MetaAnimPhaseBlend);
|
||||
m_anim = std::make_unique<MetaAnimPhaseBlend>();
|
||||
m_anim->read(reader);
|
||||
} else if (type == "random") {
|
||||
m_anim.reset(new struct MetaAnimRandom);
|
||||
m_anim = std::make_unique<MetaAnimRandom>();
|
||||
m_anim->read(reader);
|
||||
} else if (type == "sequence") {
|
||||
m_anim.reset(new struct MetaAnimSequence);
|
||||
m_anim = std::make_unique<MetaAnimSequence>();
|
||||
m_anim->read(reader);
|
||||
} else {
|
||||
m_anim.reset(nullptr);
|
||||
m_anim.reset();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,19 +12,19 @@ void MaterialSet::Material::SectionFactory::Enumerate<BigDNA::Read>(typename Rea
|
||||
type.read(reader);
|
||||
switch (ISection::Type(type.toUint32())) {
|
||||
case ISection::Type::PASS:
|
||||
section.reset(new struct SectionPASS);
|
||||
section = std::make_unique<SectionPASS>();
|
||||
section->read(reader);
|
||||
break;
|
||||
case ISection::Type::CLR:
|
||||
section.reset(new struct SectionCLR);
|
||||
section = std::make_unique<SectionCLR>();
|
||||
section->read(reader);
|
||||
break;
|
||||
case ISection::Type::INT:
|
||||
section.reset(new struct SectionINT);
|
||||
section = std::make_unique<SectionINT>();
|
||||
section->read(reader);
|
||||
break;
|
||||
default:
|
||||
section.reset(nullptr);
|
||||
section.reset();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user