Core/Misc: Use equal_range instead of lower_bound/upper_bound calls where possible.
This commit is contained in:
1 parent
2292025bf9
commit
d36c4a91ba
9 files changed
+160
-104
No files matched your search
@@ -295,6 +295,7 @@ void InstanceSaveManager::LoadResetTimes()
|
||||
|
||||
// index instance ids by map/difficulty pairs for fast reset warning send
|
||||
typedef std::multimap<uint32 /*PAIR32(map, difficulty)*/, uint32 /*instanceid*/ > ResetTimeMapDiffInstances;
|
||||
typedef std::pair<ResetTimeMapDiffInstances::const_iterator, ResetTimeMapDiffInstances::const_iterator> ResetTimeMapDiffInstancesBounds;
|
||||
ResetTimeMapDiffInstances mapDiffResetInstances;
|
||||
|
||||
QueryResult result = CharacterDatabase.Query("SELECT id, map, difficulty, resettime FROM instance ORDER BY id ASC");
|
||||
@@ -378,8 +379,6 @@ void InstanceSaveManager::LoadResetTimes()
|
||||
} while (result->NextRow());
|
||||
}
|
||||
|
||||
ResetTimeMapDiffInstances::const_iterator in_itr;
|
||||
|
||||
// calculate new global reset times for expired instances and those that have never been reset yet
|
||||
// add the global reset times to the priority queue
|
||||
for (MapDifficultyMap::const_iterator itr = sMapDifficultyMap.begin(); itr != sMapDifficultyMap.end(); ++itr)
|
||||
@@ -423,8 +422,9 @@ void InstanceSaveManager::LoadResetTimes()
|
||||
|
||||
ScheduleReset(true, t - ResetTimeDelay[type-1], InstResetEvent(type, mapid, difficulty, 0));
|
||||
|
||||
for (in_itr = mapDiffResetInstances.lower_bound(map_diff_pair); in_itr != mapDiffResetInstances.upper_bound(map_diff_pair); ++in_itr)
|
||||
ScheduleReset(true, t - ResetTimeDelay[type-1], InstResetEvent(type, mapid, difficulty, in_itr->second));
|
||||
ResetTimeMapDiffInstancesBounds range = mapDiffResetInstances.equal_range(map_diff_pair);
|
||||
for (; range.first != range.second; ++range.first)
|
||||
ScheduleReset(true, t - ResetTimeDelay[type-1], InstResetEvent(type, mapid, difficulty, range.first->second));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user