[7690] Move GetCreature/GetGameobject to class Map. Author: VladimirMangos

* This let get objects at map without reference to player or another object.
    * Simplify future implementation for per-map storage for like objects

--HG--
branch : trunk
This commit is contained in:
megamage committed 2009-04-20 20:28:19 -05:00
1 parent b4046ddf88
commit fc7e1db9fb
28 files changed
+140 -163

No files matched your search

+11 -11
View File
@@ -46,8 +46,7 @@ void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data )
if (IS_GAMEOBJECT_GUID(lguid))
{
GameObject *go =
ObjectAccessor::GetGameObject(*player, lguid);
GameObject *go = player->GetMap()->GetGameObject(lguid);
// not check distance for GO in case owned GO (fishing bobber case, for example) or Fishing hole GO
if (!go || (go->GetOwnerGUID() != _player->GetGUID() && go->GetGoType() != GAMEOBJECT_TYPE_FISHINGHOLE) && !go->IsWithinDistInMap(_player,INTERACTION_DISTANCE))
@@ -82,8 +81,7 @@ void WorldSession::HandleAutostoreLootItemOpcode( WorldPacket & recv_data )
}
else
{
Creature* pCreature =
ObjectAccessor::GetCreature(*player, lguid);
Creature* pCreature = GetPlayer()->GetMap()->GetCreature(lguid);
bool ok_loot = pCreature && pCreature->isAlive() == (player->getClass()==CLASS_ROGUE && pCreature->lootForPickPocketed);
@@ -175,7 +173,7 @@ void WorldSession::HandleLootMoneyOpcode( WorldPacket & /*recv_data*/ )
{
case HIGHGUID_GAMEOBJECT:
{
GameObject *pGameObject = ObjectAccessor::GetGameObject(*GetPlayer(), guid);
GameObject *pGameObject = GetPlayer()->GetMap()->GetGameObject(guid);
// not check distance for GO in case owned GO (fishing bobber case, for example)
if( pGameObject && (pGameObject->GetOwnerGUID()==_player->GetGUID() || pGameObject->IsWithinDistInMap(_player,INTERACTION_DISTANCE)) )
@@ -200,7 +198,7 @@ void WorldSession::HandleLootMoneyOpcode( WorldPacket & /*recv_data*/ )
}
case HIGHGUID_UNIT:
{
Creature* pCreature = ObjectAccessor::GetCreature(*GetPlayer(), guid);
Creature* pCreature = GetPlayer()->GetMap()->GetCreature(guid);
bool ok_loot = pCreature && pCreature->isAlive() == (player->getClass()==CLASS_ROGUE && pCreature->lootForPickPocketed);
@@ -288,10 +286,12 @@ void WorldSession::DoLootRelease( uint64 lguid )
player->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_LOOTING);
if(!player->IsInWorld())
return;
if (IS_GAMEOBJECT_GUID(lguid))
{
GameObject *go =
ObjectAccessor::GetGameObject(*player, lguid);
GameObject *go = GetPlayer()->GetMap()->GetGameObject(lguid);
// not check distance for GO in case owned GO (fishing bobber case, for example) or Fishing hole GO
if (!go || (go->GetOwnerGUID() != _player->GetGUID() && go->GetGoType() != GAMEOBJECT_TYPE_FISHINGHOLE) && !go->IsWithinDistInMap(_player,INTERACTION_DISTANCE))
@@ -413,7 +413,7 @@ void WorldSession::DoLootRelease( uint64 lguid )
}
else
{
Creature* pCreature = ObjectAccessor::GetCreature(*player, lguid);
Creature* pCreature = GetPlayer()->GetMap()->GetCreature(lguid);
bool ok_loot = pCreature && pCreature->isAlive() == (player->getClass()==CLASS_ROGUE && pCreature->lootForPickPocketed);
if ( !ok_loot || !pCreature->IsWithinDistInMap(_player,INTERACTION_DISTANCE) )
@@ -470,7 +470,7 @@ void WorldSession::HandleLootMasterGiveOpcode( WorldPacket & recv_data )
if(IS_CREATURE_GUID(GetPlayer()->GetLootGUID()))
{
Creature *pCreature = ObjectAccessor::GetCreature(*GetPlayer(), lootguid);
Creature *pCreature = GetPlayer()->GetMap()->GetCreature(lootguid);
if(!pCreature)
return;
@@ -478,7 +478,7 @@ void WorldSession::HandleLootMasterGiveOpcode( WorldPacket & recv_data )
}
else if(IS_GAMEOBJECT_GUID(GetPlayer()->GetLootGUID()))
{
GameObject *pGO = ObjectAccessor::GetGameObject(*GetPlayer(), lootguid);
GameObject *pGO = GetPlayer()->GetMap()->GetGameObject(lootguid);
if(!pGO)
return;