mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-22 05:06:24 +00:00
refactor(Core/Misc): Use emplace_back instead of push_back to avoid extra copy/m… (#20114)
refactor: Use emplace_back instead of push_back to avoid extra copy/move operations
This commit is contained in:
@@ -54,8 +54,8 @@ void LootItemStorage::LoadStorageFromDB()
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
StoredLootItemList& itemList = lootItemStore[ObjectGuid::Create<HighGuid::Item>(fields[0].Get<uint32>())];
|
||||
itemList.push_back(StoredLootItem(fields[1].Get<uint32>(), fields[2].Get<uint32>(), fields[3].Get<uint32>(), fields[4].Get<int32>(), fields[5].Get<uint32>(), fields[6].Get<bool>(),
|
||||
fields[7].Get<bool>(), fields[8].Get<bool>(), fields[9].Get<bool>(), fields[10].Get<bool>(), fields[11].Get<bool>(), fields[12].Get<uint32>()));
|
||||
itemList.emplace_back(fields[1].Get<uint32>(), fields[2].Get<uint32>(), fields[3].Get<uint32>(), fields[4].Get<int32>(), fields[5].Get<uint32>(), fields[6].Get<bool>(),
|
||||
fields[7].Get<bool>(), fields[8].Get<bool>(), fields[9].Get<bool>(), fields[10].Get<bool>(), fields[11].Get<bool>(), fields[12].Get<uint32>());
|
||||
|
||||
++count;
|
||||
} while (result->NextRow());
|
||||
@@ -94,7 +94,7 @@ void LootItemStorage::AddNewStoredLoot(Loot* loot, Player* /*player*/)
|
||||
// Gold at first
|
||||
if (loot->gold)
|
||||
{
|
||||
itemList.push_back(StoredLootItem(0, 0, loot->gold, 0, 0, false, false, false, false, false, false, 0));
|
||||
itemList.emplace_back(0, 0, loot->gold, 0, 0, false, false, false, false, false, false, 0);
|
||||
|
||||
uint8 index = 0;
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEMCONTAINER_SINGLE_ITEM);
|
||||
@@ -134,8 +134,8 @@ void LootItemStorage::AddNewStoredLoot(Loot* loot, Player* /*player*/)
|
||||
conditionLootId = li->conditions.front()->SourceGroup;
|
||||
}
|
||||
|
||||
itemList.push_back(StoredLootItem(li->itemid, li->itemIndex, li->count, li->randomPropertyId, li->randomSuffix, li->follow_loot_rules, li->freeforall, li->is_blocked, li->is_counted,
|
||||
li->is_underthreshold, li->needs_quest, conditionLootId));
|
||||
itemList.emplace_back(li->itemid, li->itemIndex, li->count, li->randomPropertyId, li->randomSuffix, li->follow_loot_rules, li->freeforall, li->is_blocked, li->is_counted,
|
||||
li->is_underthreshold, li->needs_quest, conditionLootId);
|
||||
|
||||
uint8 index = 0;
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ITEMCONTAINER_SINGLE_ITEM);
|
||||
|
||||
Reference in New Issue
Block a user