CAnimSetLoader: Collapse emplace_back() and back() calls into one

emplace_back returns a reference to the emplaced element.
This commit is contained in:
Lioncash 2020-06-18 12:47:35 -04:00
parent 4f4ef28bb1
commit 1d54df7185
1 changed files with 4 additions and 6 deletions

View File

@ -7,8 +7,7 @@ CAnimSetLoader::CAnimSetLoader() = default;
void CAnimSetLoader::LoadCorruptionCHAR(IInputStream& rCHAR) void CAnimSetLoader::LoadCorruptionCHAR(IInputStream& rCHAR)
{ {
pSet->mCharacters.emplace_back(SSetCharacter()); SSetCharacter& rChar = pSet->mCharacters.emplace_back();
SSetCharacter& rChar = pSet->mCharacters.back();
// Character Header // Character Header
rChar.ID = rCHAR.ReadByte(); rChar.ID = rCHAR.ReadByte();
@ -98,8 +97,7 @@ void CAnimSetLoader::LoadReturnsCHAR(IInputStream& rCHAR)
uint8 Flag = rCHAR.ReadByte(); uint8 Flag = rCHAR.ReadByte();
rCHAR.Skip(1); rCHAR.Skip(1);
pSet->mCharacters.emplace_back( SSetCharacter() );; SSetCharacter& rChar = pSet->mCharacters.emplace_back();
SSetCharacter& rChar = pSet->mCharacters.back();
// Character Header // Character Header
rChar.ID = 0; rChar.ID = 0;
@ -655,7 +653,7 @@ std::unique_ptr<CSourceAnimData> CAnimSetLoader::LoadSAND(IInputStream& rSAND, C
for (uint32 TransitionIdx = 0; TransitionIdx < NumTransitions; TransitionIdx++) for (uint32 TransitionIdx = 0; TransitionIdx < NumTransitions; TransitionIdx++)
{ {
uint8 UnkByte = rSAND.ReadByte(); [[maybe_unused]] const uint8 UnkByte = rSAND.ReadByte();
ASSERT(UnkByte == 0); ASSERT(UnkByte == 0);
CSourceAnimData::STransition Transition; CSourceAnimData::STransition Transition;
@ -670,7 +668,7 @@ std::unique_ptr<CSourceAnimData> CAnimSetLoader::LoadSAND(IInputStream& rSAND, C
for (uint32 HalfIdx = 0; HalfIdx < NumHalfTransitions; HalfIdx++) for (uint32 HalfIdx = 0; HalfIdx < NumHalfTransitions; HalfIdx++)
{ {
uint8 UnkByte = rSAND.ReadByte(); [[maybe_unused]] const uint8 UnkByte = rSAND.ReadByte();
ASSERT(UnkByte == 0); ASSERT(UnkByte == 0);
CSourceAnimData::SHalfTransition HalfTrans; CSourceAnimData::SHalfTransition HalfTrans;