mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
Small vehicle related code cleanup.
This commit is contained in:
parent
3f4821acfb
commit
0798b151cc
7 changed files with 14 additions and 12 deletions
|
|
@ -1073,7 +1073,7 @@ Creature* ChatHandler::getSelectedCreature()
|
|||
if(!m_session)
|
||||
return NULL;
|
||||
|
||||
return ObjectAccessor::GetCreatureOrPet(*m_session->GetPlayer(),m_session->GetPlayer()->GetSelection());
|
||||
return ObjectAccessor::GetCreatureOrPetOrVehicle(*m_session->GetPlayer(),m_session->GetPlayer()->GetSelection());
|
||||
}
|
||||
|
||||
char* ChatHandler::extractKeyFromLink(char* text, char const* linkType, char** something1)
|
||||
|
|
|
|||
|
|
@ -58,8 +58,9 @@ uint32 GuidHigh2TypeId(uint32 guid_hi)
|
|||
case HIGHGUID_DYNAMICOBJECT:return TYPEID_DYNAMICOBJECT;
|
||||
case HIGHGUID_CORPSE: return TYPEID_CORPSE;
|
||||
case HIGHGUID_MO_TRANSPORT: return TYPEID_GAMEOBJECT;
|
||||
case HIGHGUID_VEHICLE: return TYPEID_UNIT;
|
||||
}
|
||||
return 10; // unknown
|
||||
return MAX_TYPEID; // unknown
|
||||
}
|
||||
|
||||
Object::Object( )
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ enum TypeID
|
|||
TYPEID_AIGROUP = 8,
|
||||
TYPEID_AREATRIGGER = 9
|
||||
};
|
||||
#define MAX_TYPEID 10
|
||||
|
||||
uint32 GuidHigh2TypeId(uint32 guid_hi);
|
||||
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ ObjectAccessor::GetNPCIfCanInteractWith(Player const &player, uint64 guid, uint3
|
|||
}
|
||||
|
||||
Creature*
|
||||
ObjectAccessor::GetCreatureOrPet(WorldObject const &u, uint64 guid)
|
||||
ObjectAccessor::GetCreatureOrPetOrVehicle(WorldObject const &u, uint64 guid)
|
||||
{
|
||||
if(Creature *unit = GetPet(guid))
|
||||
return unit;
|
||||
|
|
@ -164,7 +164,7 @@ ObjectAccessor::GetUnit(WorldObject const &u, uint64 guid)
|
|||
if(IS_PLAYER_GUID(guid))
|
||||
return FindPlayer(guid);
|
||||
|
||||
return GetCreatureOrPet(u, guid);
|
||||
return GetCreatureOrPetOrVehicle(u, guid);
|
||||
}
|
||||
|
||||
Corpse*
|
||||
|
|
@ -187,7 +187,7 @@ Object* ObjectAccessor::GetObjectByTypeMask(Player const &p, uint64 guid, uint32
|
|||
|
||||
if(typemask & TYPEMASK_UNIT)
|
||||
{
|
||||
obj = GetCreatureOrPet(p,guid);
|
||||
obj = GetCreatureOrPetOrVehicle(p,guid);
|
||||
if(obj) return obj;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -139,7 +139,7 @@ class MANGOS_DLL_DECL ObjectAccessor : public MaNGOS::Singleton<ObjectAccessor,
|
|||
static Object* GetObjectByTypeMask(Player const &, uint64, uint32 typemask);
|
||||
static Creature* GetNPCIfCanInteractWith(Player const &player, uint64 guid, uint32 npcflagmask);
|
||||
static Creature* GetCreature(WorldObject const &, uint64);
|
||||
static Creature* GetCreatureOrPet(WorldObject const &, uint64);
|
||||
static Creature* GetCreatureOrPetOrVehicle(WorldObject const &, uint64);
|
||||
static Unit* GetUnit(WorldObject const &, uint64);
|
||||
static Pet* GetPet(Unit const &, uint64 guid) { return GetPet(guid); }
|
||||
static Player* GetPlayer(Unit const &, uint64 guid) { return FindPlayer(guid); }
|
||||
|
|
|
|||
|
|
@ -285,7 +285,7 @@ void WorldSession::HandlePetNameQuery( WorldPacket & recv_data )
|
|||
|
||||
void WorldSession::SendPetNameQuery( uint64 petguid, uint32 petnumber)
|
||||
{
|
||||
Creature* pet = ObjectAccessor::GetCreatureOrPet(*_player, petguid);
|
||||
Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, petguid);
|
||||
if(!pet || !pet->GetCharmInfo() || pet->GetCharmInfo()->GetPetNumber() != petnumber)
|
||||
return;
|
||||
|
||||
|
|
@ -327,7 +327,7 @@ void WorldSession::HandlePetSetAction( WorldPacket & recv_data )
|
|||
if(ObjectAccessor::FindPlayer(petguid))
|
||||
return;
|
||||
|
||||
Creature* pet = ObjectAccessor::GetCreatureOrPet(*_player, petguid);
|
||||
Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, petguid);
|
||||
|
||||
if(!pet || (pet != _player->GetPet() && pet != _player->GetCharm()))
|
||||
{
|
||||
|
|
@ -464,7 +464,7 @@ void WorldSession::HandlePetAbandon( WorldPacket & recv_data )
|
|||
sLog.outDetail( "HandlePetAbandon. CMSG_PET_ABANDON pet guid is %u", GUID_LOPART(guid) );
|
||||
|
||||
// pet/charmed
|
||||
Creature* pet = ObjectAccessor::GetCreatureOrPet(*_player, guid);
|
||||
Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, guid);
|
||||
if(pet)
|
||||
{
|
||||
if(pet->isPet())
|
||||
|
|
@ -529,7 +529,7 @@ void WorldSession::HandlePetSpellAutocastOpcode( WorldPacket& recvPacket )
|
|||
if(ObjectAccessor::FindPlayer(guid))
|
||||
return;
|
||||
|
||||
Creature* pet=ObjectAccessor::GetCreatureOrPet(*_player,guid);
|
||||
Creature* pet=ObjectAccessor::GetCreatureOrPetOrVehicle(*_player,guid);
|
||||
|
||||
if(!pet || (pet != _player->GetPet() && pet != _player->GetCharm()))
|
||||
{
|
||||
|
|
@ -581,7 +581,7 @@ void WorldSession::HandlePetCastSpellOpcode( WorldPacket& recvPacket )
|
|||
if (GUID_HIPART(guid) == HIGHGUID_PLAYER)
|
||||
return;
|
||||
|
||||
Creature* pet = ObjectAccessor::GetCreatureOrPet(*_player,guid);
|
||||
Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player,guid);
|
||||
|
||||
if(!pet || (pet != _player->GetPet() && pet!= _player->GetCharm()))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -357,7 +357,7 @@ void WorldSession::HandlePetCancelAuraOpcode( WorldPacket& recvPacket)
|
|||
return;
|
||||
}
|
||||
|
||||
Creature* pet=ObjectAccessor::GetCreatureOrPet(*_player,guid);
|
||||
Creature* pet=ObjectAccessor::GetCreatureOrPetOrVehicle(*_player,guid);
|
||||
|
||||
if(!pet)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue