Permalink
Browse files

update old spline movement state before interrupt

  • Loading branch information...
SilverIce committed Nov 15, 2011
1 parent 1dc81f9 commit a5ead44f59daed2de9c5d38ffd340ca06dd2afd8
Showing with 7 additions and 2 deletions.
  1. +1 −1 Movement/UpdatableSpline.h
  2. +6 −1 Movement/UpdatableSpline.hpp
@@ -35,7 +35,7 @@ namespace Movement
void recache(int32 recacheDelay = 100);
- void PrepareMoveSplineArgs(MoveSplineInitArgs& args, UnitMoveFlag& moveFlag_new) const;
+ void PrepareMoveSplineArgs(MoveSplineInitArgs& args, UnitMoveFlag& moveFlag_new);
public:
void Execute(TaskExecutor_Args& args);
private:
@@ -94,8 +94,13 @@ namespace Movement
PacketBuilder::SplinePathSend(m_owner, MsgBroadcast(m_owner));
}
- void MoveSplineUpdatable::PrepareMoveSplineArgs(MoveSplineInitArgs& args, UnitMoveFlag& moveFlag_new) const
+ void MoveSplineUpdatable::PrepareMoveSplineArgs(MoveSplineInitArgs& args, UnitMoveFlag& moveFlag_new)
{
+ // There is a big chance that current position is outdated in case movement was already launched.
+ // So, to lauch new movement from current _real_ position we have to update old state
+ if (isEnabled())
+ recache(1);
+
mov_assert(!args.path.empty());
args.path[0] = m_owner.GetPosition3(); //correct first vertex
args.splineId = m_owner.Updater().NewMoveSplineId();

0 comments on commit a5ead44

Please sign in to comment.