--HG--
branch : trunk
This commit is contained in:
XTZGZoReX
2010-01-13 18:25:46 +01:00
9 changed files with 70 additions and 55 deletions

View File

@@ -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());