2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-08 23:07:42 +00:00

CThardus: std::move vector instances in constructor

Previously the std::move calls wouldn't do anything, as the parameters
were constant references, so we can take them by value and move into the
constructor and then move the parameters into the member variables.

While we're at it, we can initialize the vectors in place instead of
constructing and then assigning to them.
This commit is contained in:
Lioncash
2020-03-05 21:14:08 -05:00
parent 2f9dd38bbe
commit 6917132a94
3 changed files with 10 additions and 13 deletions

View File

@@ -2574,16 +2574,14 @@ CEntity* ScriptLoader::LoadThardus(CStateManager& mgr, CInputStream& in, int pro
int sfxID2 = in.readUint32Big();
int sfxID3 = in.readUint32Big();
int sfxID4 = in.readUint32Big();
std::vector<CStaticRes> mData1(7);
std::vector<CStaticRes> mData2(7);
mData1.assign(std::rbegin(staticRes[0]), std::rend(staticRes[0]));
mData2.assign(std::rbegin(staticRes[1]), std::rend(staticRes[1]));
std::vector<CStaticRes> mData1(std::rbegin(staticRes[0]), std::rend(staticRes[0]));
std::vector<CStaticRes> mData2(std::rbegin(staticRes[1]), std::rend(staticRes[1]));
CModelData mData(CAnimRes(animParms.GetACSFile(), 0, actHead.x40_scale, animParms.GetInitialAnimation(), true));
return new MP1::CThardus(mgr.AllocateUniqueId(), actHead.x0_name, info, actHead.x10_transform, std::move(mData),
actParms, pInfo, mData1, mData2, particle1, particle2, particle3, f1, f2, f3, f4, f5, f6,
stateMachine, particle4, particle5, particle6, particle7, particle8, particle9, texture,
sfxID1, particle10, sfxID2, sfxID3, sfxID4);
actParms, pInfo, std::move(mData1), std::move(mData2), particle1, particle2, particle3, f1,
f2, f3, f4, f5, f6, stateMachine, particle4, particle5, particle6, particle7, particle8,
particle9, texture, sfxID1, particle10, sfxID2, sfxID3, sfxID4);
}
CEntity* ScriptLoader::LoadWallCrawlerSwarm(CStateManager& mgr, CInputStream& in, int propCount,