aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2013-06-01 17:47:02 +0200
committerShauren <shauren.trinity@gmail.com>2013-06-01 17:47:02 +0200
commit891d97ec4cef21d3131ee11d5cce64a300b02ea4 (patch)
tree7b510a6827121017a1a0af0968a47a1e71d687d4
parent9251a605445a6f6ffe77b4fab03d368c93fcdacd (diff)
Core/Movement
* Changed speed selection for flying creatures - use MOVE_RUN by default. * Do not add MOVEMENTFLAG_WALKING to creatures that did not have it but called .SetWalk for their movement
-rw-r--r--src/server/game/Movement/Spline/MoveSplineInit.cpp29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/server/game/Movement/Spline/MoveSplineInit.cpp b/src/server/game/Movement/Spline/MoveSplineInit.cpp
index 192a539db54..2f4224c8b91 100644
--- a/src/server/game/Movement/Spline/MoveSplineInit.cpp
+++ b/src/server/game/Movement/Spline/MoveSplineInit.cpp
@@ -29,11 +29,7 @@ namespace Movement
{
UnitMoveType SelectSpeedType(uint32 moveFlags)
{
- /*! Not sure about MOVEMENTFLAG_CAN_FLY here - do creatures that can fly
- but are on ground right now also have it? If yes, this needs a more
- dynamic check, such as is flying now
- */
- if (moveFlags & (MOVEMENTFLAG_FLYING | MOVEMENTFLAG_CAN_FLY | MOVEMENTFLAG_DISABLE_GRAVITY))
+ if (moveFlags & MOVEMENTFLAG_FLYING)
{
if (moveFlags & MOVEMENTFLAG_BACKWARD /*&& speed_obj.flight >= speed_obj.flight_back*/)
return MOVE_FLIGHT_BACK;
@@ -55,6 +51,8 @@ namespace Movement
else if (moveFlags & MOVEMENTFLAG_BACKWARD /*&& speed_obj.run >= speed_obj.run_back*/)
return MOVE_RUN_BACK;
+ // Flying creatures use MOVEMENTFLAG_CAN_FLY or MOVEMENTFLAG_DISABLE_GRAVITY
+ // Run speed is their default flight speed.
return MOVE_RUN;
}
@@ -90,22 +88,25 @@ namespace Movement
move_spline.onTransport = transport;
uint32 moveFlags = unit->m_movementInfo.GetMovementFlags();
- if (args.flags.walkmode)
- moveFlags |= MOVEMENTFLAG_WALKING;
- else
- moveFlags &= ~MOVEMENTFLAG_WALKING;
-
moveFlags |= (MOVEMENTFLAG_SPLINE_ENABLED|MOVEMENTFLAG_FORWARD);
+ if (moveFlags & MOVEMENTFLAG_ROOT)
+ moveFlags &= ~MOVEMENTFLAG_MASK_MOVING;
+
if (!args.HasVelocity)
- args.velocity = unit->GetSpeed(SelectSpeedType(moveFlags));
+ {
+ // If spline is initialized with SetWalk method it only means we need to select
+ // walk move speed for it but not add walk flag to unit
+ uint32 moveFlagsForSpeed = moveFlags;
+ if (args.flags.walkmode)
+ moveFlagsForSpeed |= MOVEMENTFLAG_WALKING;
+
+ args.velocity = unit->GetSpeed(SelectSpeedType(moveFlagsForSpeed));
+ }
if (!args.Validate(unit))
return 0;
- if (moveFlags & MOVEMENTFLAG_ROOT)
- moveFlags &= ~MOVEMENTFLAG_MASK_MOVING;
-
unit->m_movementInfo.SetMovementFlags((MovementFlags)moveFlags);
move_spline.Initialize(args);