diff options
author | n0n4m3 <none@none> | 2010-01-16 19:18:53 +0300 |
---|---|---|
committer | n0n4m3 <none@none> | 2010-01-16 19:18:53 +0300 |
commit | 9be16cf605d1b565ad4e84badbb61c1b121fee1f (patch) | |
tree | c4ea4911517b73a49f006bb7b9f70aa84f8916ef /src | |
parent | 706718b28c8f028d39ec3ca7d3bfefb9f9a62add (diff) |
Some replacements .count to .find for better performance - original patch by zhenya.
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/game/LootMgr.cpp | 22 | ||||
-rw-r--r-- | src/game/ObjectMgr.cpp | 4 | ||||
-rw-r--r-- | src/game/SkillDiscovery.cpp | 4 |
3 files changed, 15 insertions, 15 deletions
diff --git a/src/game/LootMgr.cpp b/src/game/LootMgr.cpp index 1ad17b7f6fd..38467e8acfe 100644 --- a/src/game/LootMgr.cpp +++ b/src/game/LootMgr.cpp @@ -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 diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 22f70ca007c..89fe1b6a7ea 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -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); } } diff --git a/src/game/SkillDiscovery.cpp b/src/game/SkillDiscovery.cpp index ed6041f216d..3741e1720a4 100644 --- a/src/game/SkillDiscovery.cpp +++ b/src/game/SkillDiscovery.cpp @@ -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", |