mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[10594] Use equal_range instead of lower_bound/upper_bound pairs
(based on zergtmn's repo commit 0499169) Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
0caa0e32dd
commit
2fa5fa43bd
13 changed files with 207 additions and 182 deletions
|
|
@ -795,16 +795,15 @@ void GameEventMgr::UpdateEventQuests(uint16 event_id, bool Activate)
|
|||
QuestRelList::iterator itr;
|
||||
for (itr = mGameEventQuests[event_id].begin();itr != mGameEventQuests[event_id].end();++itr)
|
||||
{
|
||||
QuestRelations &CreatureQuestMap = sObjectMgr.mCreatureQuestRelations;
|
||||
QuestRelationsMap &CreatureQuestMap = sObjectMgr.GetCreatureQuestRelationsMap();
|
||||
|
||||
if (Activate) // Add the pair(id,quest) to the multimap
|
||||
CreatureQuestMap.insert(QuestRelations::value_type(itr->first, itr->second));
|
||||
CreatureQuestMap.insert(QuestRelationsMap::value_type(itr->first, itr->second));
|
||||
else
|
||||
{ // Remove the pair(id,quest) from the multimap
|
||||
QuestRelations::iterator qitr = CreatureQuestMap.find(itr->first);
|
||||
if (qitr == CreatureQuestMap.end())
|
||||
continue;
|
||||
QuestRelations::iterator lastElement = CreatureQuestMap.upper_bound(itr->first);
|
||||
for ( ;qitr != lastElement;++qitr)
|
||||
std::pair<QuestRelationsMap::iterator, QuestRelationsMap::iterator> bounds = CreatureQuestMap.equal_range(itr->first);
|
||||
|
||||
for(QuestRelationsMap::iterator qitr = bounds.first; qitr != bounds.second; ++qitr)
|
||||
{
|
||||
if (qitr->second == itr->second)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue