mirror of https://github.com/AxioDL/metaforce.git
CActorContraption: Unindent code in CreateFlameThrower() where applicable
We can invert a conditional to allow much of the code to be unindented.
This commit is contained in:
parent
4b140d8954
commit
1b52070f4f
|
@ -83,21 +83,22 @@ void MP1::CActorContraption::DoUserAnimEvent(CStateManager& mgr, const CInt32POI
|
||||||
}
|
}
|
||||||
|
|
||||||
CFlameThrower* MP1::CActorContraption::CreateFlameThrower(std::string_view name, CStateManager& mgr) {
|
CFlameThrower* MP1::CActorContraption::CreateFlameThrower(std::string_view name, CStateManager& mgr) {
|
||||||
auto it = std::find_if(x2e8_children.begin(), x2e8_children.end(),
|
const auto it = std::find_if(x2e8_children.cbegin(), x2e8_children.cend(),
|
||||||
[&name](const std::pair<TUniqueId, std::string>& p) { return p.second == name; });
|
[&name](const auto& p) { return p.second == name; });
|
||||||
|
|
||||||
if (it == x2e8_children.end()) {
|
if (it != x2e8_children.cend()) {
|
||||||
TUniqueId id = mgr.AllocateUniqueId();
|
return static_cast<CFlameThrower*>(mgr.ObjectById(it->first));
|
||||||
CFlameInfo flameInfo(6, 6, x308_flameFxId, 20, 0.5f, 1.f, 1.f);
|
|
||||||
CFlameThrower* ret = new CFlameThrower(x300_flameThrowerGen, name, EWeaponType::Missile, flameInfo,
|
|
||||||
zeus::CTransform(), EMaterialTypes::CollisionActor, x30c_dInfo, id,
|
|
||||||
GetAreaId(), GetUniqueId(), EProjectileAttrib::None, -1, -1, -1);
|
|
||||||
|
|
||||||
x2e8_children.emplace_back(id, name);
|
|
||||||
|
|
||||||
mgr.AddObject(ret);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
return static_cast<CFlameThrower*>(mgr.ObjectById(it->first));
|
|
||||||
|
const TUniqueId id = mgr.AllocateUniqueId();
|
||||||
|
const CFlameInfo flameInfo(6, 6, x308_flameFxId, 20, 0.5f, 1.f, 1.f);
|
||||||
|
auto* ret = new CFlameThrower(x300_flameThrowerGen, name, EWeaponType::Missile, flameInfo, zeus::CTransform(),
|
||||||
|
EMaterialTypes::CollisionActor, x30c_dInfo, id, GetAreaId(), GetUniqueId(),
|
||||||
|
EProjectileAttrib::None, -1, -1, -1);
|
||||||
|
|
||||||
|
x2e8_children.emplace_back(id, name);
|
||||||
|
|
||||||
|
mgr.AddObject(ret);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
} // namespace urde
|
} // namespace urde
|
||||||
|
|
Loading…
Reference in New Issue