mirror of https://github.com/AxioDL/metaforce.git
Merge pull request #70 from lioncash/move
CEntityInfo: std::move vector in constructor
This commit is contained in:
commit
3e9cb69c32
|
@ -1292,21 +1292,21 @@ void CStateManager::LoadScriptObjects(TAreaId aid, CInputStream& in, std::vector
|
||||||
|
|
||||||
std::pair<TEditorId, TUniqueId> CStateManager::LoadScriptObject(TAreaId aid, EScriptObjectType type, u32 length,
|
std::pair<TEditorId, TUniqueId> CStateManager::LoadScriptObject(TAreaId aid, EScriptObjectType type, u32 length,
|
||||||
CInputStream& in) {
|
CInputStream& in) {
|
||||||
TEditorId id = in.readUint32Big();
|
const TEditorId id = in.readUint32Big();
|
||||||
u32 connCount = in.readUint32Big();
|
const u32 connCount = in.readUint32Big();
|
||||||
length -= 8;
|
length -= 8;
|
||||||
std::vector<SConnection> conns;
|
std::vector<SConnection> conns;
|
||||||
conns.reserve(connCount);
|
conns.reserve(connCount);
|
||||||
for (int i = 0; i < connCount; ++i) {
|
for (u32 i = 0; i < connCount; ++i) {
|
||||||
EScriptObjectState state = EScriptObjectState(in.readUint32Big());
|
const auto state = EScriptObjectState(in.readUint32Big());
|
||||||
EScriptObjectMessage msg = EScriptObjectMessage(in.readUint32Big());
|
const auto msg = EScriptObjectMessage(in.readUint32Big());
|
||||||
TEditorId target = in.readUint32Big();
|
const TEditorId target = in.readUint32Big();
|
||||||
length -= 12;
|
length -= 12;
|
||||||
conns.push_back(SConnection{state, msg, target});
|
conns.push_back(SConnection{state, msg, target});
|
||||||
}
|
}
|
||||||
u32 propCount = in.readUint32Big();
|
const u32 propCount = in.readUint32Big();
|
||||||
length -= 4;
|
length -= 4;
|
||||||
auto startPos = in.position();
|
const auto startPos = in.position();
|
||||||
|
|
||||||
bool error = false;
|
bool error = false;
|
||||||
FScriptLoader loader = {};
|
FScriptLoader loader = {};
|
||||||
|
@ -1315,7 +1315,7 @@ std::pair<TEditorId, TUniqueId> CStateManager::LoadScriptObject(TAreaId aid, ESc
|
||||||
|
|
||||||
CEntity* ent = nullptr;
|
CEntity* ent = nullptr;
|
||||||
if (loader) {
|
if (loader) {
|
||||||
CEntityInfo info(aid, conns, id);
|
const CEntityInfo info(aid, std::move(conns), id);
|
||||||
ent = loader(*this, in, propCount, info);
|
ent = loader(*this, in, propCount, info);
|
||||||
} else {
|
} else {
|
||||||
error = true;
|
error = true;
|
||||||
|
|
|
@ -18,8 +18,8 @@ class CEntityInfo {
|
||||||
TEditorId x14_editorId;
|
TEditorId x14_editorId;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CEntityInfo(TAreaId aid, const std::vector<SConnection>& conns, TEditorId eid = kInvalidEditorId)
|
CEntityInfo(TAreaId aid, std::vector<SConnection> conns, TEditorId eid = kInvalidEditorId)
|
||||||
: x0_areaId(aid), x4_conns(conns), x14_editorId(eid) {}
|
: x0_areaId(aid), x4_conns(std::move(conns)), x14_editorId(eid) {}
|
||||||
TAreaId GetAreaId() const { return x0_areaId; }
|
TAreaId GetAreaId() const { return x0_areaId; }
|
||||||
std::vector<SConnection> GetConnectionList() const { return x4_conns; }
|
std::vector<SConnection> GetConnectionList() const { return x4_conns; }
|
||||||
TEditorId GetEditorId() const { return x14_editorId; }
|
TEditorId GetEditorId() const { return x14_editorId; }
|
||||||
|
|
Loading…
Reference in New Issue