mirror of
https://github.com/araxiaonline/TrinityCore2.git
synced 2026-06-20 06:49:29 -04:00
Some replacements .count to .find for better performance - original patch by zhenya.
--HG-- branch : trunk
This commit is contained in:
+11
-11
@@ -1187,7 +1187,7 @@ void LoadLootTemplates_Creature()
|
||||
{
|
||||
if (uint32 lootid = cInfo->lootid)
|
||||
{
|
||||
if (!ids_set.count(lootid))
|
||||
if (ids_set.find(lootid) == ids_set.end())
|
||||
LootTemplates_Creature.ReportNotExistedId(lootid);
|
||||
else
|
||||
ids_setUsed.insert(lootid);
|
||||
@@ -1213,7 +1213,7 @@ void LoadLootTemplates_Disenchant()
|
||||
{
|
||||
if (uint32 lootid = proto->DisenchantID)
|
||||
{
|
||||
if (!ids_set.count(lootid))
|
||||
if (ids_set.find(lootid) == ids_set.end())
|
||||
LootTemplates_Disenchant.ReportNotExistedId(lootid);
|
||||
else
|
||||
ids_setUsed.insert(lootid);
|
||||
@@ -1234,7 +1234,7 @@ void LoadLootTemplates_Fishing()
|
||||
// remove real entries and check existence loot
|
||||
for (uint32 i = 1; i < sAreaStore.GetNumRows(); ++i)
|
||||
if (AreaTableEntry const* areaEntry = sAreaStore.LookupEntry(i))
|
||||
if (ids_set.count(areaEntry->ID))
|
||||
if (ids_set.find(areaEntry->ID) != ids_set.end())
|
||||
ids_set.erase(areaEntry->ID);
|
||||
|
||||
// output error for any still listed (not referenced from appropriate table) ids
|
||||
@@ -1253,7 +1253,7 @@ void LoadLootTemplates_Gameobject()
|
||||
{
|
||||
if (uint32 lootid = gInfo->GetLootId())
|
||||
{
|
||||
if (objmgr.IsGoOfSpecificEntrySpawned(gInfo->id) && !ids_set.count(lootid))
|
||||
if (objmgr.IsGoOfSpecificEntrySpawned(gInfo->id) && ids_set.find(lootid) == ids_set.end())
|
||||
LootTemplates_Gameobject.ReportNotExistedId(lootid);
|
||||
else
|
||||
ids_setUsed.insert(lootid);
|
||||
@@ -1275,7 +1275,7 @@ void LoadLootTemplates_Item()
|
||||
// remove real entries and check existence loot
|
||||
for (uint32 i = 1; i < sItemStorage.MaxEntry; ++i)
|
||||
if (ItemPrototype const *proto = sItemStorage.LookupEntry<ItemPrototype>(i))
|
||||
if (ids_set.count(proto->ItemId))
|
||||
if (ids_set.find(proto->ItemId) != ids_set.end())
|
||||
ids_set.erase(proto->ItemId);
|
||||
|
||||
// output error for any still listed (not referenced from appropriate table) ids
|
||||
@@ -1297,7 +1297,7 @@ void LoadLootTemplates_Milling()
|
||||
if ((proto->BagFamily & BAG_FAMILY_MASK_HERBS) == 0)
|
||||
continue;
|
||||
|
||||
if (ids_set.count(proto->ItemId))
|
||||
if (ids_set.find(proto->ItemId) != ids_set.end())
|
||||
ids_set.erase(proto->ItemId);
|
||||
}
|
||||
|
||||
@@ -1317,7 +1317,7 @@ void LoadLootTemplates_Pickpocketing()
|
||||
{
|
||||
if(uint32 lootid = cInfo->pickpocketLootId)
|
||||
{
|
||||
if(!ids_set.count(lootid))
|
||||
if (ids_set.find(lootid) == ids_set.end())
|
||||
LootTemplates_Pickpocketing.ReportNotExistedId(lootid);
|
||||
else
|
||||
ids_setUsed.insert(lootid);
|
||||
@@ -1346,7 +1346,7 @@ void LoadLootTemplates_Prospecting()
|
||||
if ((proto->BagFamily & BAG_FAMILY_MASK_MINING_SUPP) == 0)
|
||||
continue;
|
||||
|
||||
if (ids_set.count(proto->ItemId))
|
||||
if (ids_set.find(proto->ItemId) != ids_set.end())
|
||||
ids_set.erase(proto->ItemId);
|
||||
}
|
||||
|
||||
@@ -1362,7 +1362,7 @@ void LoadLootTemplates_Mail()
|
||||
// remove real entries and check existence loot
|
||||
for(uint32 i = 1; i < sMailTemplateStore.GetNumRows(); ++i)
|
||||
if(sMailTemplateStore.LookupEntry(i))
|
||||
if(ids_set.count(i))
|
||||
if (ids_set.find(i) != ids_set.end())
|
||||
ids_set.erase(i);
|
||||
|
||||
// output error for any still listed (not referenced from appropriate table) ids
|
||||
@@ -1381,7 +1381,7 @@ void LoadLootTemplates_Skinning()
|
||||
{
|
||||
if (uint32 lootid = cInfo->SkinLootId)
|
||||
{
|
||||
if (!ids_set.count(lootid))
|
||||
if (ids_set.find(lootid) == ids_set.end())
|
||||
LootTemplates_Skinning.ReportNotExistedId(lootid);
|
||||
else
|
||||
ids_setUsed.insert(lootid);
|
||||
@@ -1411,7 +1411,7 @@ void LoadLootTemplates_Spell()
|
||||
if( !IsLootCraftingSpell(spellInfo))
|
||||
continue;
|
||||
|
||||
if(!ids_set.count(spell_id))
|
||||
if (ids_set.find(spell_id) == ids_set.end())
|
||||
{
|
||||
// not report about not trainable spells (optionally supported by DB)
|
||||
// ignore 61756 (Northrend Inscription Research (FAST QA VERSION) for example
|
||||
|
||||
@@ -8112,7 +8112,7 @@ void ObjectMgr::LoadTrainerSpell()
|
||||
|
||||
if(!(cInfo->npcflag & UNIT_NPC_FLAG_TRAINER))
|
||||
{
|
||||
if(skip_trainers.count(entry) == 0)
|
||||
if (skip_trainers.find(entry) == skip_trainers.end())
|
||||
{
|
||||
sLog.outErrorDb("Table `npc_trainer` have data for not creature template (Entry: %u) without trainer flag, ignore", entry);
|
||||
skip_trainers.insert(entry);
|
||||
@@ -8663,7 +8663,7 @@ void ObjectMgr::CheckScripts(ScriptMapMap const& scripts,std::set<int32>& ids)
|
||||
if(!GetTrinityStringLocale (itrM->second.dataint))
|
||||
sLog.outErrorDb( "Table `db_script_string` not has string id %u used db script (ID: %u)", itrM->second.dataint, itrMM->first);
|
||||
|
||||
if(ids.count(itrM->second.dataint))
|
||||
if (ids.find(itrM->second.dataint) != ids.end())
|
||||
ids.erase(itrM->second.dataint);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,7 +91,7 @@ void LoadSkillDiscoveryTable()
|
||||
SpellEntry const* reqSpellEntry = sSpellStore.LookupEntry(reqSkillOrSpell);
|
||||
if (!reqSpellEntry)
|
||||
{
|
||||
if(reportedReqSpells.count(reqSkillOrSpell)==0)
|
||||
if (reportedReqSpells.find(reqSkillOrSpell) == reportedReqSpells.end())
|
||||
{
|
||||
sLog.outErrorDb("Spell (ID: %u) have not existed spell (ID: %i) in `reqSpell` field in `skill_discovery_template` table",spellId,reqSkillOrSpell);
|
||||
reportedReqSpells.insert(reqSkillOrSpell);
|
||||
@@ -104,7 +104,7 @@ void LoadSkillDiscoveryTable()
|
||||
// explicit discovery ability
|
||||
!IsExplicitDiscoverySpell(reqSpellEntry))
|
||||
{
|
||||
if (reportedReqSpells.count(reqSkillOrSpell)==0)
|
||||
if (reportedReqSpells.find(reqSkillOrSpell) == reportedReqSpells.end())
|
||||
{
|
||||
sLog.outErrorDb("Spell (ID: %u) not have MECHANIC_DISCOVERY (28) value in Mechanic field in spell.dbc"
|
||||
" and not 100%% chance random discovery ability but listed for spellId %u (and maybe more) in `skill_discovery_template` table",
|
||||
|
||||
Reference in New Issue
Block a user