chore(unit-object-accessor): add findConnectedPlayer to object accessor (#3155)

This commit is contained in:
Stefano Borzì
2020-08-17 10:36:42 +02:00
committed by GitHub
parent c373668a41
commit 408366f39f
2 changed files with 10 additions and 3 deletions
+7 -2
View File
@@ -169,7 +169,7 @@ Player* ObjectAccessor::FindPlayer(uint64 guid)
Player* ObjectAccessor::FindPlayerInOrOutOfWorld(uint64 guid) Player* ObjectAccessor::FindPlayerInOrOutOfWorld(uint64 guid)
{ {
return GetObjectInOrOutOfWorld(guid, (Player*)NULL); return GetObjectInOrOutOfWorld(guid, (Player*)NULL);
} }
Unit* ObjectAccessor::FindUnit(uint64 guid) Unit* ObjectAccessor::FindUnit(uint64 guid)
@@ -177,6 +177,11 @@ Unit* ObjectAccessor::FindUnit(uint64 guid)
return GetObjectInWorld(guid, (Unit*)NULL); return GetObjectInWorld(guid, (Unit*)NULL);
} }
Player* ObjectAccessor::FindConnectedPlayer(uint64 const& guid)
{
return HashMapHolder<Player>::Find(guid);
}
Player* ObjectAccessor::FindPlayerByName(std::string const& name, bool checkInWorld) Player* ObjectAccessor::FindPlayerByName(std::string const& name, bool checkInWorld)
{ {
/*ACORE_READ_GUARD(HashMapHolder<Player>::LockType, *HashMapHolder<Player>::GetLock()); /*ACORE_READ_GUARD(HashMapHolder<Player>::LockType, *HashMapHolder<Player>::GetLock());
@@ -486,7 +491,7 @@ void ObjectAccessor::Update(uint32 /*diff*/)
} }
void Map::BuildAndSendUpdateForObjects() void Map::BuildAndSendUpdateForObjects()
{ {
UpdateDataMapType update_players; UpdateDataMapType update_players;
UpdatePlayerSet player_set; UpdatePlayerSet player_set;
+3 -1
View File
@@ -188,8 +188,10 @@ class ObjectAccessor
// ACCESS LIKE THAT IS NOT THREAD SAFE // ACCESS LIKE THAT IS NOT THREAD SAFE
static Pet* FindPet(uint64); static Pet* FindPet(uint64);
static Player* FindPlayer(uint64); static Player* FindPlayer(uint64);
static Player* FindPlayerInOrOutOfWorld(uint64 m_guid); static Player* FindPlayerInOrOutOfWorld(uint64 m_guid);
static Unit* FindUnit(uint64); static Unit* FindUnit(uint64);
static Player* FindConnectedPlayer(uint64 const&);
static Player* FindPlayerByName(std::string const& name, bool checkInWorld = true); static Player* FindPlayerByName(std::string const& name, bool checkInWorld = true);
static std::map<std::string, Player*> playerNameToPlayerPointer; // pussywizard: optimization static std::map<std::string, Player*> playerNameToPlayerPointer; // pussywizard: optimization