Core/Movement: Defined movement force type enum

This commit is contained in:
Shauren
2021-12-08 19:02:02 +01:00
parent 8341082ac4
commit e2de5000ac
4 changed files with 13 additions and 6 deletions
@@ -21,6 +21,7 @@
#include "MovementTypedefs.h"
#include "PacketUtilities.h"
#include "Unit.h"
#include "Util.h"
ByteBuffer& operator<<(ByteBuffer& data, MovementInfo const& movementInfo)
{
@@ -438,7 +439,7 @@ void WorldPackets::Movement::CommonMovement::WriteMovementForceWithDirection(Mov
{
data << movementForce.ID;
data << movementForce.Origin;
if (movementForce.Type == 1 && objectPosition) // gravity
if (movementForce.Type == MovementForceType::Gravity && objectPosition)
{
TaggedPosition<Position::XYZ> direction;
if (movementForce.Magnitude != 0.0f)
@@ -468,7 +469,7 @@ void WorldPackets::Movement::CommonMovement::WriteMovementForceWithDirection(Mov
data << uint32(movementForce.TransportID);
data << float(movementForce.Magnitude);
data.WriteBits(movementForce.Type, 2);
data.WriteBits(AsUnderlyingType(movementForce.Type), 2);
data.WriteBit(movementForce.Unused910 != 0);
data.FlushBits();
@@ -696,7 +697,7 @@ ByteBuffer& operator>>(ByteBuffer& data, MovementForce& movementForce)
data >> movementForce.Direction;
data >> movementForce.TransportID;
data >> movementForce.Magnitude;
movementForce.Type = data.ReadBits(2);
movementForce.Type = MovementForceType(data.ReadBits(2));
bool has910 = data.ReadBit();
if (has910)
data >> movementForce.Unused910;