CCharacterInfo: Make use of emplace_back() where applicable

We can construct these elements in place. While we're at it, we can mark
the count variables at const to be explicit.
This commit is contained in:
Lioncash 2020-02-28 04:51:16 -05:00
parent d2c86f98d1
commit 435a6ea1d4
1 changed files with 16 additions and 12 deletions

View File

@ -3,26 +3,30 @@
namespace urde { namespace urde {
CCharacterInfo::CParticleResData::CParticleResData(CInputStream& in, u16 tableCount) { CCharacterInfo::CParticleResData::CParticleResData(CInputStream& in, u16 tableCount) {
u32 partCount = in.readUint32Big(); const u32 partCount = in.readUint32Big();
x0_part.reserve(partCount); x0_part.reserve(partCount);
for (u32 i = 0; i < partCount; ++i) for (u32 i = 0; i < partCount; ++i) {
x0_part.push_back(in.readUint32Big()); x0_part.emplace_back(in.readUint32Big());
}
u32 swhcCount = in.readUint32Big(); const u32 swhcCount = in.readUint32Big();
x10_swhc.reserve(swhcCount); x10_swhc.reserve(swhcCount);
for (u32 i = 0; i < swhcCount; ++i) for (u32 i = 0; i < swhcCount; ++i) {
x10_swhc.push_back(in.readUint32Big()); x10_swhc.emplace_back(in.readUint32Big());
}
u32 unkCount = in.readUint32Big(); const u32 unkCount = in.readUint32Big();
x20_elsc.reserve(unkCount); x20_elsc.reserve(unkCount);
for (u32 i = 0; i < unkCount; ++i) for (u32 i = 0; i < unkCount; ++i) {
x20_elsc.push_back(in.readUint32Big()); x20_elsc.emplace_back(in.readUint32Big());
}
if (tableCount > 5) { if (tableCount > 5) {
u32 elscCount = in.readUint32Big(); const u32 elscCount = in.readUint32Big();
x30_elsc.reserve(elscCount); x30_elsc.reserve(elscCount);
for (u32 i = 0; i < elscCount; ++i) for (u32 i = 0; i < elscCount; ++i) {
x30_elsc.push_back(in.readUint32Big()); x30_elsc.emplace_back(in.readUint32Big());
}
} }
} }