本文整理汇总了C++中TransportInfo::GetTransport方法的典型用法代码示例。如果您正苦于以下问题:C++ TransportInfo::GetTransport方法的具体用法?C++ TransportInfo::GetTransport怎么用?C++ TransportInfo::GetTransport使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TransportInfo
的用法示例。
在下文中一共展示了TransportInfo::GetTransport方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleRequestVehicleExit
void WorldSession::HandleRequestVehicleExit(WorldPacket& recvPacket)
{
DEBUG_LOG("WORLD: Received CMSG_REQUEST_VEHICLE_EXIT");
recvPacket.hexlike();
TransportInfo* transportInfo = _player->GetTransportInfo();
if (!transportInfo || !transportInfo->IsOnVehicle())
return;
((Unit*)transportInfo->GetTransport())->RemoveSpellsCausingAura(SPELL_AURA_CONTROL_VEHICLE, _player->GetObjectGuid());
}
示例2: HandleChangeSeatsOnControlledVehicle
void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket& recvPacket)
{
DEBUG_LOG("WORLD: Received CMSG_CHANGE_SEATS_ON_CONTROLLED_VEHICLE");
recvPacket.hexlike();
ObjectGuid srcVehicleGuid;
MovementInfo movementInfo;
ObjectGuid destVehicleGuid;
uint8 seat;
recvPacket >> srcVehicleGuid.ReadAsPacked();
recvPacket >> movementInfo; // Not used at the moment
recvPacket >> destVehicleGuid.ReadAsPacked();
recvPacket >> seat;
TransportInfo* transportInfo = _player->GetTransportInfo();
if (!transportInfo || !transportInfo->IsOnVehicle())
return;
Unit* srcVehicle = (Unit*)transportInfo->GetTransport();
// Something went wrong
if (srcVehicleGuid != srcVehicle->GetObjectGuid())
return;
if (srcVehicleGuid != destVehicleGuid)
{
Unit* destVehicle = _player->GetMap()->GetUnit(destVehicleGuid);
if (!destVehicle || !destVehicle->IsVehicle())
return;
// Change vehicle is not possible
if (destVehicle->GetVehicleInfo()->GetVehicleEntry()->m_flags & VEHICLE_FLAG_DISABLE_SWITCH)
return;
SpellClickInfoMapBounds clickPair = sObjectMgr.GetSpellClickInfoMapBounds(destVehicle->GetEntry());
for (SpellClickInfoMap::const_iterator itr = clickPair.first; itr != clickPair.second; ++itr)
if (itr->second.IsFitToRequirements(_player))
_player->CastSpell(destVehicle, itr->second.spellId, true);
}
else
srcVehicle->GetVehicleInfo()->SwitchSeat(_player, seat);
}
示例3: HandleRequestVehicleSwitchSeat
void WorldSession::HandleRequestVehicleSwitchSeat(WorldPacket& recvPacket)
{
DEBUG_LOG("WORLD: Received CMSG_REQUEST_VEHICLE_SWITCH_SEAT");
recvPacket.hexlike();
ObjectGuid vehicleGuid;
uint8 seat;
recvPacket >> vehicleGuid.ReadAsPacked();
recvPacket >> seat;
TransportInfo* transportInfo = _player->GetTransportInfo();
if (!transportInfo || !transportInfo->IsOnVehicle())
return;
Unit* vehicle = (Unit*)transportInfo->GetTransport();
// Something went wrong
if (vehicleGuid != vehicle->GetObjectGuid())
return;
vehicle->GetVehicleInfo()->SwitchSeat(_player, seat);
}
示例4: HandleDismissControlledVehicle
void WorldSession::HandleDismissControlledVehicle(WorldPacket& recvPacket)
{
DEBUG_LOG("WORLD: Received CMSG_DISMISS_CONTROLLED_VEHICLE");
recvPacket.hexlike();
ObjectGuid vehicleGuid;
MovementInfo movementInfo; // Not used at the moment
recvPacket >> vehicleGuid.ReadAsPacked();
recvPacket >> movementInfo;
TransportInfo* transportInfo = _player->GetTransportInfo();
if (!transportInfo || !transportInfo->IsOnVehicle())
return;
Unit* vehicle = (Unit*)transportInfo->GetTransport();
// Something went wrong
if (vehicleGuid != vehicle->GetObjectGuid())
return;
// Remove Vehicle Control Aura
vehicle->RemoveSpellsCausingAura(SPELL_AURA_CONTROL_VEHICLE, _player->GetObjectGuid());
}