mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 19:37:02 +00:00
[11455] Use ObjectGuid in HashMapHolder
This commit is contained in:
parent
b647835469
commit
51031c2d24
8 changed files with 42 additions and 40 deletions
|
|
@ -144,47 +144,49 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data )
|
|||
|
||||
// TODO: Guard Player map
|
||||
HashMapHolder<Player>::MapType& m = sObjectAccessor.GetPlayers();
|
||||
for(HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
{
|
||||
Player* pl = itr->second;
|
||||
|
||||
if (security == SEC_PLAYER)
|
||||
{
|
||||
// player can see member of other team only if CONFIG_BOOL_ALLOW_TWO_SIDE_WHO_LIST
|
||||
if (itr->second->GetTeam() != team && !allowTwoSideWhoList )
|
||||
if (pl->GetTeam() != team && !allowTwoSideWhoList )
|
||||
continue;
|
||||
|
||||
// player can see MODERATOR, GAME MASTER, ADMINISTRATOR only if CONFIG_GM_IN_WHO_LIST
|
||||
if (itr->second->GetSession()->GetSecurity() > gmLevelInWhoList)
|
||||
if (pl->GetSession()->GetSecurity() > gmLevelInWhoList)
|
||||
continue;
|
||||
}
|
||||
|
||||
// do not process players which are not in world
|
||||
if(!(itr->second->IsInWorld()))
|
||||
if (!pl->IsInWorld())
|
||||
continue;
|
||||
|
||||
// check if target is globally visible for player
|
||||
if (!(itr->second->IsVisibleGloballyFor(_player)))
|
||||
if (!pl->IsVisibleGloballyFor(_player))
|
||||
continue;
|
||||
|
||||
// check if target's level is in level range
|
||||
uint32 lvl = itr->second->getLevel();
|
||||
uint32 lvl = pl->getLevel();
|
||||
if (lvl < level_min || lvl > level_max)
|
||||
continue;
|
||||
|
||||
// check if class matches classmask
|
||||
uint32 class_ = itr->second->getClass();
|
||||
uint32 class_ = pl->getClass();
|
||||
if (!(classmask & (1 << class_)))
|
||||
continue;
|
||||
|
||||
// check if race matches racemask
|
||||
uint32 race = itr->second->getRace();
|
||||
uint32 race = pl->getRace();
|
||||
if (!(racemask & (1 << race)))
|
||||
continue;
|
||||
|
||||
uint32 pzoneid = itr->second->GetZoneId();
|
||||
uint8 gender = itr->second->getGender();
|
||||
uint32 pzoneid = pl->GetZoneId();
|
||||
uint8 gender = pl->getGender();
|
||||
|
||||
bool z_show = true;
|
||||
for(uint32 i = 0; i < zones_count; ++i)
|
||||
for (uint32 i = 0; i < zones_count; ++i)
|
||||
{
|
||||
if(zoneids[i] == pzoneid)
|
||||
{
|
||||
|
|
@ -197,7 +199,7 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data )
|
|||
if (!z_show)
|
||||
continue;
|
||||
|
||||
std::string pname = itr->second->GetName();
|
||||
std::string pname = pl->GetName();
|
||||
std::wstring wpname;
|
||||
if(!Utf8toWStr(pname,wpname))
|
||||
continue;
|
||||
|
|
@ -206,9 +208,9 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data )
|
|||
if (!(wplayer_name.empty() || wpname.find(wplayer_name) != std::wstring::npos))
|
||||
continue;
|
||||
|
||||
std::string gname = sGuildMgr.GetGuildNameById(itr->second->GetGuildId());
|
||||
std::string gname = sGuildMgr.GetGuildNameById(pl->GetGuildId());
|
||||
std::wstring wgname;
|
||||
if(!Utf8toWStr(gname,wgname))
|
||||
if (!Utf8toWStr(gname,wgname))
|
||||
continue;
|
||||
wstrToLower(wgname);
|
||||
|
||||
|
|
@ -216,11 +218,11 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data )
|
|||
continue;
|
||||
|
||||
std::string aname;
|
||||
if(AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(itr->second->GetZoneId()))
|
||||
if (AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(pzoneid))
|
||||
aname = areaEntry->area_name[GetSessionDbcLocale()];
|
||||
|
||||
bool s_show = true;
|
||||
for(uint32 i = 0; i < str_count; ++i)
|
||||
for (uint32 i = 0; i < str_count; ++i)
|
||||
{
|
||||
if (!str[i].empty())
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue