AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
debug_commandscript::CreatureCountWorker Class Reference

Public Member Functions

 CreatureCountWorker ()
 
void Visit (std::unordered_map< ObjectGuid, Creature * > &creatureMap)
 
template<class T >
void Visit (std::unordered_map< ObjectGuid, T * > &)
 
std::vector< std::pair< uint32, uint32 > > GetTopCreatureCount (uint32 count)
 

Private Attributes

std::unordered_map< uint32, uint32creatureIds
 

Detailed Description

Constructor & Destructor Documentation

◆ CreatureCountWorker()

debug_commandscript::CreatureCountWorker::CreatureCountWorker ( )
inline
1285{ }

Member Function Documentation

◆ GetTopCreatureCount()

std::vector< std::pair< uint32, uint32 > > debug_commandscript::CreatureCountWorker::GetTopCreatureCount ( uint32  count)
inline
1300 {
1301 auto comp = [](std::pair<uint32, uint32> const& a, std::pair<uint32, uint32> const& b)
1302 {
1303 return a.second > b.second;
1304 };
1305 std::set<std::pair<uint32, uint32>, decltype(comp)> set(creatureIds.begin(), creatureIds.end(), comp);
1306
1307 count = std::min(count, uint32(set.size()));
1308 std::vector<std::pair<uint32, uint32>> result(count);
1309 std::copy_n(set.begin(), count, result.begin());
1310
1311 return result;
1312 }
std::uint32_t uint32
Definition: Define.h:108
std::unordered_map< uint32, uint32 > creatureIds
Definition: cs_debug.cpp:1315

References creatureIds.

Referenced by debug_commandscript::HandleDebugObjectCountMap().

◆ Visit() [1/2]

void debug_commandscript::CreatureCountWorker::Visit ( std::unordered_map< ObjectGuid, Creature * > &  creatureMap)
inline
1288 {
1289 for (auto const& p : creatureMap)
1290 {
1291 uint32& count = creatureIds[p.second->GetEntry()];
1292 ++count;
1293 }
1294 }

References creatureIds.

◆ Visit() [2/2]

template<class T >
void debug_commandscript::CreatureCountWorker::Visit ( std::unordered_map< ObjectGuid, T * > &  )
inline
1297{ }

Member Data Documentation

◆ creatureIds

std::unordered_map<uint32, uint32> debug_commandscript::CreatureCountWorker::creatureIds
private

Referenced by GetTopCreatureCount(), and Visit().