From 04b62bb9eea773ce4afc8c58332ce569feb2c9f3 Mon Sep 17 00:00:00 2001 From: NoFantasy Date: Sun, 29 Aug 2010 11:03:55 +0200 Subject: [PATCH] [10420] Avoid send stop packet in PointMovementGenerator when unit is not moving Also never send stop packet when destinationHolder hasArrived, it's expected that unit is already not moving. Signed-off-by: NoFantasy --- src/game/PointMovementGenerator.cpp | 13 +++++++++---- src/shared/revision_nr.h | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/game/PointMovementGenerator.cpp b/src/game/PointMovementGenerator.cpp index f2805c93f..b8dcb4298 100644 --- a/src/game/PointMovementGenerator.cpp +++ b/src/game/PointMovementGenerator.cpp @@ -28,8 +28,11 @@ template void PointMovementGenerator::Initialize(T &unit) { - unit.StopMoving(); + if (!unit.IsStopped()) + unit.StopMoving(); + unit.addUnitState(UNIT_STAT_ROAMING|UNIT_STAT_ROAMING_MOVE); + Traveller traveller(unit); i_destinationHolder.SetDestination(traveller, i_x, i_y, i_z); @@ -52,11 +55,12 @@ void PointMovementGenerator::Interrupt(T &unit) template void PointMovementGenerator::Reset(T &unit) { - unit.StopMoving(); + if (!unit.IsStopped()) + unit.StopMoving(); + unit.addUnitState(UNIT_STAT_ROAMING|UNIT_STAT_ROAMING_MOVE); } - template bool PointMovementGenerator::Update(T &unit, const uint32 &diff) { @@ -70,6 +74,7 @@ bool PointMovementGenerator::Update(T &unit, const uint32 &diff) } unit.addUnitState(UNIT_STAT_ROAMING_MOVE); + Traveller traveller(unit); if (i_destinationHolder.UpdateTraveller(traveller, diff, false)) { @@ -79,7 +84,7 @@ bool PointMovementGenerator::Update(T &unit, const uint32 &diff) if(i_destinationHolder.HasArrived()) { - unit.StopMoving(); + unit.clearUnitState(UNIT_STAT_ROAMING_MOVE); MovementInform(unit); return false; } diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index eee9c2573..c3e8a3711 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10419" + #define REVISION_NR "10420" #endif // __REVISION_NR_H__