本文整理汇总了C++中MovementInfo::init方法的典型用法代码示例。如果您正苦于以下问题:C++ MovementInfo::init方法的具体用法?C++ MovementInfo::init怎么用?C++ MovementInfo::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MovementInfo
的用法示例。
在下文中一共展示了MovementInfo::init方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleChangeVehicleSeat
void WorldSession::HandleChangeVehicleSeat( WorldPacket &recv_data ){
if( _player->GetCurrentVehicle() == NULL )
return;
switch( recv_data.GetOpcode() ){
case CMSG_REQUEST_VEHICLE_PREV_SEAT:
_player->GetCurrentVehicle()->MovePassengerToPrevSeat( _player );
break;
case CMSG_REQUEST_VEHICLE_NEXT_SEAT:
_player->GetCurrentVehicle()->MovePassengerToNextSeat( _player );
break;
case CMSG_REQUEST_VEHICLE_SWITCH_SEAT:{
WoWGuid vehicle;
uint8 seat = 0;
recv_data >> vehicle;
recv_data >> seat;
if( vehicle.GetOldGuid() == _player->GetCurrentVehicle()->GetOwner()->GetGUID() ){
_player->GetCurrentVehicle()->MovePassengerToSeat( _player, seat );
}else{
Unit *u = _player->GetMapMgr()->GetUnit( vehicle.GetOldGuid() );
if( u == NULL )
return;
if( u->GetVehicleComponent() == NULL )
return;
// We can only switch to accessory or back to the parent vehicle
if( !_player->GetCurrentVehicle()->HasAccessoryWithGUID( vehicle.GetOldGuid() ) &&
!u->GetVehicleComponent()->HasAccessoryWithGUID( _player->GetCurrentVehicle()->GetOwner()->GetGUID() ) )
return;
_player->GetCurrentVehicle()->EjectPassenger( _player );
u->GetVehicleComponent()->AddPassengerToSeat( _player, seat );
}
break;}
case CMSG_CHANGE_SEATS_ON_CONTROLLED_VEHICLE:{
WoWGuid src_guid;
WoWGuid dst_guid;
uint8 seat = 0;
MovementInfo mov;
recv_data >> src_guid;
mov.init( recv_data );
recv_data >> dst_guid;
recv_data >> seat;
Unit *src_vehicle = _player->GetMapMgr()->GetUnit( src_guid.GetOldGuid() );
if( src_vehicle == NULL )
return;
if( src_vehicle->GetVehicleComponent() == NULL )
return;
if( src_vehicle->GetGUID() != _player->GetCurrentVehicle()->GetOwner()->GetGUID() )
return;
Unit *dst_vehicle = _player->GetMapMgr()->GetUnit( dst_guid.GetOldGuid() );
if( dst_vehicle == NULL )
return;
if( dst_vehicle->GetVehicleComponent() == NULL )
return;
if( src_vehicle->GetGUID() == dst_vehicle->GetGUID() ){
src_vehicle->GetVehicleComponent()->MovePassengerToSeat( _player, seat );
}else{
// We can only switch to accessory or back to parent vehicle
if( !src_vehicle->GetVehicleComponent()->HasAccessoryWithGUID( dst_vehicle->GetGUID() ) &&
!dst_vehicle->GetVehicleComponent()->HasAccessoryWithGUID( src_vehicle->GetGUID() ) )
return;
_player->GetCurrentVehicle()->EjectPassenger( _player );
dst_vehicle->GetVehicleComponent()->AddPassengerToSeat( _player, seat );
}
break;}
}
}