diff options
Diffstat (limited to 'src/game/MovementHandler.cpp')
-rw-r--r-- | src/game/MovementHandler.cpp | 58 |
1 files changed, 28 insertions, 30 deletions
diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp index 53d36436142..def605bc8c7 100644 --- a/src/game/MovementHandler.cpp +++ b/src/game/MovementHandler.cpp @@ -307,10 +307,10 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data ) } if (!mover->GetTransport() && !mover->GetVehicle()) - {
- GameObject *go = mover->GetMap()->GetGameObject(movementInfo.t_guid);
- if (!go || go->GetGoType() != GAMEOBJECT_TYPE_TRANSPORT)
- movementInfo.flags &= ~MOVEMENTFLAG_ONTRANSPORT;
+ { + GameObject *go = mover->GetMap()->GetGameObject(movementInfo.t_guid); + if (!go || go->GetGoType() != GAMEOBJECT_TYPE_TRANSPORT) + movementInfo.flags &= ~MOVEMENTFLAG_ONTRANSPORT; } } else if (plMover && plMover->GetTransport()) // if we were on a transport, leave @@ -358,18 +358,18 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data ) plMover->SetPosition(movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o); plMover->UpdateFallInformationIfNeed(movementInfo, opcode); - // If on vehicle, update carried players
- if (Vehicle *vehicle=plMover->GetVehicleKit())
- {
- if (plMover->IsVehicle())
- {
- for (int i=0; i < 8; ++i)
- {
- if (Unit *passenger = vehicle->GetPassenger(i))
- if (passenger != NULL && passenger->GetTypeId() == TYPEID_PLAYER)
- ((Player*)passenger)->SetPosition(movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o);
- }
- }
+ // If on vehicle, update carried players + if (Vehicle *vehicle=plMover->GetVehicleKit()) + { + if (plMover->IsVehicle()) + { + for (int i=0; i < 8; ++i) + { + if (Unit *passenger = vehicle->GetPassenger(i)) + if (passenger != NULL && passenger->GetTypeId() == TYPEID_PLAYER) + ((Player*)passenger)->SetPosition(movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o); + } + } } if (movementInfo.z < -500.0f) @@ -506,20 +506,18 @@ void WorldSession::HandleSetActiveMoverOpcode(WorldPacket &recv_data) uint64 guid; recv_data >> guid; - if(guid == GetPlayer()->m_mover->GetGUID()) - return; - - if(Unit *mover = ObjectAccessor::GetUnit(*GetPlayer(), guid)) - { - GetPlayer()->SetMover(mover); - if(mover != GetPlayer() && mover->canFly()) - { - WorldPacket data(SMSG_MOVE_SET_CAN_FLY, 12); - data.append(mover->GetPackGUID()); - data << uint32(0); - SendPacket(&data); - } - } + if(GetPlayer()->IsInWorld()) + if(Unit *mover = ObjectAccessor::GetUnit(*GetPlayer(), guid)) + { + GetPlayer()->SetMover(mover); + if(mover != GetPlayer() && mover->canFly()) + { + WorldPacket data(SMSG_MOVE_SET_CAN_FLY, 12); + data.append(mover->GetPackGUID()); + data << uint32(0); + SendPacket(&data); + } + } else { sLog.outError("HandleSetActiveMoverOpcode: incorrect mover guid: mover is " UI64FMTD " and should be " UI64FMTD, guid, _player->m_mover->GetGUID()); |