diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/AI/CoreAI/PetAI.cpp | 6 | ||||
-rw-r--r-- | src/server/game/Addons/AddonMgr.cpp | 19 | ||||
-rw-r--r-- | src/server/game/Addons/AddonMgr.h | 8 | ||||
-rw-r--r-- | src/server/game/Chat/Channels/ChannelMgr.cpp | 4 | ||||
-rw-r--r-- | src/server/game/Loot/LootItemStorage.cpp | 10 | ||||
-rw-r--r-- | src/server/game/Skills/SkillDiscovery.cpp | 4 | ||||
-rw-r--r-- | src/server/scripts/Commands/cs_quest.cpp | 6 | ||||
-rw-r--r-- | src/tools/mmaps_generator/MapBuilder.cpp | 6 | ||||
-rw-r--r-- | src/tools/mmaps_generator/MapBuilder.h | 2 | ||||
-rw-r--r-- | src/tools/mmaps_generator/PathCommon.h | 2 |
10 files changed, 32 insertions, 35 deletions
diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp index 3803e815aa..4047ba8e19 100644 --- a/src/server/game/AI/CoreAI/PetAI.cpp +++ b/src/server/game/AI/CoreAI/PetAI.cpp @@ -277,7 +277,7 @@ void PetAI::UpdateAI(uint32 diff) { if (CanAttack(target) && spell->CanAutoCast(target)) { - targetSpellStore.push_back(std::make_pair(target, spell)); + targetSpellStore.emplace_back(target, spell); spellUsed = true; } } @@ -295,7 +295,7 @@ void PetAI::UpdateAI(uint32 diff) if (spell->CanAutoCast(ally)) { - targetSpellStore.push_back(std::make_pair(ally, spell)); + targetSpellStore.emplace_back(ally, spell); spellUsed = true; break; } @@ -310,7 +310,7 @@ void PetAI::UpdateAI(uint32 diff) { Spell* spell = new Spell(me, spellInfo, TRIGGERED_NONE); if (spell->CanAutoCast(me->GetVictim())) - targetSpellStore.push_back(std::make_pair(me->GetVictim(), spell)); + targetSpellStore.emplace_back(me->GetVictim(), spell); else delete spell; } diff --git a/src/server/game/Addons/AddonMgr.cpp b/src/server/game/Addons/AddonMgr.cpp index cce10efe9c..f1fe5ada51 100644 --- a/src/server/game/Addons/AddonMgr.cpp +++ b/src/server/game/Addons/AddonMgr.cpp @@ -56,7 +56,7 @@ namespace AddonMgr std::string name = fields[0].Get<std::string>(); uint32 crc = fields[1].Get<uint32>(); - m_knownAddons.push_back(SavedAddon(name, crc)); + m_knownAddons.emplace_back(name, crc); ++count; } while (result->NextRow()); @@ -76,13 +76,12 @@ namespace AddonMgr { Field* fields = result->Fetch(); - BannedAddon addon{}; - addon.Id = fields[0].Get<uint32>() + offset; - addon.Timestamp = uint32(fields[3].Get<uint64>()); - addon.NameMD5 = Acore::Crypto::MD5::GetDigestOf(fields[1].Get<std::string>()); - addon.VersionMD5 = Acore::Crypto::MD5::GetDigestOf(fields[2].Get<std::string>()); + uint32 Id = fields[0].Get<uint32>() + offset; + std::array<uint8, 16> NameMD5 = Acore::Crypto::MD5::GetDigestOf(fields[1].Get<std::string>()); + std::array<uint8, 16> VersionMD5 = Acore::Crypto::MD5::GetDigestOf(fields[2].Get<std::string>()); + uint32 Timestamp = uint32(fields[3].Get<uint64>()); - m_bannedAddons.emplace_back(addon); + m_bannedAddons.emplace_back(Id, NameMD5, VersionMD5, Timestamp); ++count2; } while (result->NextRow()); @@ -94,16 +93,14 @@ namespace AddonMgr void SaveAddon(AddonInfo const& addon) { - std::string name = addon.Name; - CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ADDON); - stmt->SetData(0, name); + stmt->SetData(0, addon.Name); stmt->SetData(1, addon.CRC); CharacterDatabase.Execute(stmt); - m_knownAddons.push_back(SavedAddon(addon.Name, addon.CRC)); + m_knownAddons.emplace_back(addon.Name, addon.CRC); } SavedAddon const* GetAddonInfo(const std::string& name) diff --git a/src/server/game/Addons/AddonMgr.h b/src/server/game/Addons/AddonMgr.h index d51fb14020..1dbbad0eb6 100644 --- a/src/server/game/Addons/AddonMgr.h +++ b/src/server/game/Addons/AddonMgr.h @@ -38,10 +38,7 @@ struct AddonInfo struct SavedAddon { - SavedAddon(std::string name, uint32 crc) : Name(std::move(name)) - { - CRC = crc; - } + SavedAddon(std::string name, uint32 crc) : Name(std::move(name)), CRC(crc) {} std::string Name; uint32 CRC; @@ -49,6 +46,9 @@ struct SavedAddon struct BannedAddon { + BannedAddon(uint32 id, std::array<uint8, 16> const& nameMD5, std::array<uint8, 16> const& versionMD5, uint32 timestamp) + : Id(id), NameMD5(nameMD5), VersionMD5(versionMD5), Timestamp(timestamp) {} + uint32 Id; std::array<uint8, 16> NameMD5; std::array<uint8, 16> VersionMD5; diff --git a/src/server/game/Chat/Channels/ChannelMgr.cpp b/src/server/game/Chat/Channels/ChannelMgr.cpp index 9716d88988..99f613b89e 100644 --- a/src/server/game/Chat/Channels/ChannelMgr.cpp +++ b/src/server/game/Chat/Channels/ChannelMgr.cpp @@ -74,7 +74,7 @@ void ChannelMgr::LoadChannels() if (!Utf8toWStr(channelName, channelWName)) { LOG_ERROR("server.loading", "Failed to load channel '{}' from database - invalid utf8 sequence? Deleted.", channelName); - toDelete.push_back({ channelName, team }); + toDelete.emplace_back(channelName, team); continue; } @@ -82,7 +82,7 @@ void ChannelMgr::LoadChannels() if (!mgr) { LOG_ERROR("server.loading", "Failed to load custom chat channel '{}' from database - invalid team {}. Deleted.", channelName, team); - toDelete.push_back({ channelName, team }); + toDelete.emplace_back(channelName, team); continue; } diff --git a/src/server/game/Loot/LootItemStorage.cpp b/src/server/game/Loot/LootItemStorage.cpp index 7127023465..fc37aba5ac 100644 --- a/src/server/game/Loot/LootItemStorage.cpp +++ b/src/server/game/Loot/LootItemStorage.cpp @@ -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); diff --git a/src/server/game/Skills/SkillDiscovery.cpp b/src/server/game/Skills/SkillDiscovery.cpp index b84cca8842..aaced18f8a 100644 --- a/src/server/game/Skills/SkillDiscovery.cpp +++ b/src/server/game/Skills/SkillDiscovery.cpp @@ -109,7 +109,7 @@ void LoadSkillDiscoveryTable() continue; } - SkillDiscoveryStore[reqSkillOrSpell].push_back(SkillDiscoveryEntry(spellId, reqSkillValue, chance)); + SkillDiscoveryStore[reqSkillOrSpell].emplace_back(spellId, reqSkillValue, chance); } else if (reqSkillOrSpell == 0) // skill case { @@ -122,7 +122,7 @@ void LoadSkillDiscoveryTable() } for (SkillLineAbilityMap::const_iterator _spell_idx = bounds.first; _spell_idx != bounds.second; ++_spell_idx) - SkillDiscoveryStore[-int32(_spell_idx->second->SkillLine)].push_back(SkillDiscoveryEntry(spellId, reqSkillValue, chance)); + SkillDiscoveryStore[-int32(_spell_idx->second->SkillLine)].emplace_back(spellId, reqSkillValue, chance); } else { diff --git a/src/server/scripts/Commands/cs_quest.cpp b/src/server/scripts/Commands/cs_quest.cpp index 1434f2e6b4..ba7cf4ebb6 100644 --- a/src/server/scripts/Commands/cs_quest.cpp +++ b/src/server/scripts/Commands/cs_quest.cpp @@ -362,7 +362,7 @@ public: continue; } - questItems.push_back(std::pair(id, count)); + questItems.emplace_back(id, count); } if (!questItems.empty()) @@ -585,7 +585,7 @@ public: for (uint32 const& itemId : quest->RewardChoiceItemId) { uint8 index = 0; - questRewardItems.push_back(std::pair(itemId, quest->RewardChoiceItemCount[index++])); + questRewardItems.emplace_back(itemId, quest->RewardChoiceItemCount[index++]); } } @@ -594,7 +594,7 @@ public: for (uint32 const& itemId : quest->RewardItemId) { uint8 index = 0; - questRewardItems.push_back(std::pair(itemId, quest->RewardItemIdCount[index++])); + questRewardItems.emplace_back(itemId, quest->RewardItemIdCount[index++]); } } diff --git a/src/tools/mmaps_generator/MapBuilder.cpp b/src/tools/mmaps_generator/MapBuilder.cpp index 3a066a33c7..aa35cee056 100644 --- a/src/tools/mmaps_generator/MapBuilder.cpp +++ b/src/tools/mmaps_generator/MapBuilder.cpp @@ -112,7 +112,7 @@ namespace MMAP mapID = uint32(atoi(file.substr(0, file.size() - 8).c_str())); if (std::find(m_tiles.begin(), m_tiles.end(), mapID) == m_tiles.end()) { - m_tiles.emplace_back(MapTiles(mapID, new std::set<uint32>)); + m_tiles.emplace_back(mapID, new std::set<uint32>); count++; } } @@ -124,7 +124,7 @@ namespace MMAP mapID = uint32(atoi(file.substr(0, file.size() - 7).c_str())); if (std::find(m_tiles.begin(), m_tiles.end(), mapID) == m_tiles.end()) { - m_tiles.emplace_back(MapTiles(mapID, new std::set<uint32>)); + m_tiles.emplace_back(mapID, new std::set<uint32>); count++; } } @@ -199,7 +199,7 @@ namespace MMAP return (*itr).m_tiles; std::set<uint32>* tiles = new std::set<uint32>(); - m_tiles.emplace_back(MapTiles(mapID, tiles)); + m_tiles.emplace_back(mapID, tiles); return tiles; } diff --git a/src/tools/mmaps_generator/MapBuilder.h b/src/tools/mmaps_generator/MapBuilder.h index 464b12d190..59b865e047 100644 --- a/src/tools/mmaps_generator/MapBuilder.h +++ b/src/tools/mmaps_generator/MapBuilder.h @@ -47,7 +47,7 @@ namespace MMAP uint32 m_mapId; std::set<uint32>* m_tiles{nullptr}; - bool operator==(uint32 id) + bool operator==(uint32 id) const { return m_mapId == id; } diff --git a/src/tools/mmaps_generator/PathCommon.h b/src/tools/mmaps_generator/PathCommon.h index 483b4783d9..8e15a8cf3e 100644 --- a/src/tools/mmaps_generator/PathCommon.h +++ b/src/tools/mmaps_generator/PathCommon.h @@ -90,7 +90,7 @@ namespace MMAP do { if ((findFileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) - fileList.push_back(std::string(findFileInfo.cFileName)); + fileList.emplace_back(findFileInfo.cFileName); } while (FindNextFile(hFind, &findFileInfo)); FindClose(hFind); |