mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-24 19:06:49 +01:00
Core/Objects: Refactored MovementInfo structure
This commit is contained in:
@@ -283,14 +283,14 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
|
||||
{
|
||||
// transports size limited
|
||||
// (also received at zeppelin leave by some reason with t_* as absolute in continent coordinates, can be safely skipped)
|
||||
if (movementInfo.t_pos.GetPositionX() > 50 || movementInfo.t_pos.GetPositionY() > 50 || movementInfo.t_pos.GetPositionZ() > 50)
|
||||
if (movementInfo.transport.pos.GetPositionX() > 50 || movementInfo.transport.pos.GetPositionY() > 50 || movementInfo.transport.pos.GetPositionZ() > 50)
|
||||
{
|
||||
recvData.rfinish(); // prevent warnings spam
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Trinity::IsValidMapCoord(movementInfo.pos.GetPositionX() + movementInfo.t_pos.GetPositionX(), movementInfo.pos.GetPositionY() + movementInfo.t_pos.GetPositionY(),
|
||||
movementInfo.pos.GetPositionZ() + movementInfo.t_pos.GetPositionZ(), movementInfo.pos.GetOrientation() + movementInfo.t_pos.GetOrientation()))
|
||||
if (!Trinity::IsValidMapCoord(movementInfo.pos.GetPositionX() + movementInfo.transport.pos.GetPositionX(), movementInfo.pos.GetPositionY() + movementInfo.transport.pos.GetPositionY(),
|
||||
movementInfo.pos.GetPositionZ() + movementInfo.transport.pos.GetPositionZ(), movementInfo.pos.GetOrientation() + movementInfo.transport.pos.GetOrientation()))
|
||||
{
|
||||
recvData.rfinish(); // prevent warnings spam
|
||||
return;
|
||||
@@ -304,7 +304,7 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
|
||||
// elevators also cause the client to send MOVEMENTFLAG_ONTRANSPORT - just dismount if the guid can be found in the transport list
|
||||
for (MapManager::TransportSet::const_iterator iter = sMapMgr->m_Transports.begin(); iter != sMapMgr->m_Transports.end(); ++iter)
|
||||
{
|
||||
if ((*iter)->GetGUID() == movementInfo.t_guid)
|
||||
if ((*iter)->GetGUID() == movementInfo.transport.guid)
|
||||
{
|
||||
plrMover->m_transport = *iter;
|
||||
(*iter)->AddPassenger(plrMover);
|
||||
@@ -312,13 +312,13 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (plrMover->GetTransport()->GetGUID() != movementInfo.t_guid)
|
||||
else if (plrMover->GetTransport()->GetGUID() != movementInfo.transport.guid)
|
||||
{
|
||||
bool foundNewTransport = false;
|
||||
plrMover->m_transport->RemovePassenger(plrMover);
|
||||
for (MapManager::TransportSet::const_iterator iter = sMapMgr->m_Transports.begin(); iter != sMapMgr->m_Transports.end(); ++iter)
|
||||
{
|
||||
if ((*iter)->GetGUID() == movementInfo.t_guid)
|
||||
if ((*iter)->GetGUID() == movementInfo.transport.guid)
|
||||
{
|
||||
foundNewTransport = true;
|
||||
plrMover->m_transport = *iter;
|
||||
@@ -330,14 +330,14 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
|
||||
if (!foundNewTransport)
|
||||
{
|
||||
plrMover->m_transport = NULL;
|
||||
movementInfo.ClearTransport();
|
||||
movementInfo.transport.Reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!mover->GetTransport() && !mover->GetVehicle())
|
||||
{
|
||||
GameObject* go = mover->GetMap()->GetGameObject(movementInfo.t_guid);
|
||||
GameObject* go = mover->GetMap()->GetGameObject(movementInfo.transport.guid);
|
||||
if (!go || go->GetGoType() != GAMEOBJECT_TYPE_TRANSPORT)
|
||||
movementInfo.flags &= ~MOVEMENTFLAG_ONTRANSPORT;
|
||||
}
|
||||
@@ -346,7 +346,7 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
|
||||
{
|
||||
plrMover->m_transport->RemovePassenger(plrMover);
|
||||
plrMover->m_transport = NULL;
|
||||
movementInfo.ClearTransport();
|
||||
movementInfo.transport.Reset();
|
||||
}
|
||||
|
||||
// fall damage generation (ignore in flight case that can be triggered also at lags in moment teleportation to another map).
|
||||
@@ -542,10 +542,10 @@ void WorldSession::HandleMoveKnockBackAck(WorldPacket& recvData)
|
||||
_player->BuildMovementPacket(&data);
|
||||
|
||||
// knockback specific info
|
||||
data << movementInfo.j_sinAngle;
|
||||
data << movementInfo.j_cosAngle;
|
||||
data << movementInfo.j_xyspeed;
|
||||
data << movementInfo.j_zspeed;
|
||||
data << movementInfo.jump.sinAngle;
|
||||
data << movementInfo.jump.cosAngle;
|
||||
data << movementInfo.jump.xyspeed;
|
||||
data << movementInfo.jump.zspeed;
|
||||
|
||||
_player->SendMessageToSet(&data, false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user