1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-04-01 22:36:39 +00:00

Avoid unnecessary copies

This commit is contained in:
elsid 2022-01-28 01:00:52 +01:00
parent 0b5f10e41b
commit 3877d227f4
No known key found for this signature in database
GPG key ID: B845CB9FEE18AB40

View file

@ -32,15 +32,14 @@ namespace ESM
std::map<std::pair<std::string, bool>, int> ownerMap; std::map<std::pair<std::string, bool>, int> ownerMap;
while (esm.isNextSub("FNAM") || esm.isNextSub("ONAM")) while (esm.isNextSub("FNAM") || esm.isNextSub("ONAM"))
{ {
std::string subname = esm.retSubName().toString(); const bool isFaction = (esm.retSubName() == "FNAM");
std::string owner = esm.getHString(); std::string owner = esm.getHString();
bool isFaction = (subname == "FNAM");
int count; int count;
esm.getHNT(count, "COUN"); esm.getHNT(count, "COUN");
ownerMap.insert(std::make_pair(std::make_pair(owner, isFaction), count)); ownerMap.emplace(std::make_pair(std::move(owner), isFaction), count);
} }
mStolenItems[itemid] = ownerMap; mStolenItems.insert_or_assign(std::move(itemid), std::move(ownerMap));
} }
} }