mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[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 <nofantasy@nf.no>
This commit is contained in:
parent
0d363cc77a
commit
04b62bb9ee
2 changed files with 10 additions and 5 deletions
|
|
@ -28,8 +28,11 @@
|
|||
template<class T>
|
||||
void PointMovementGenerator<T>::Initialize(T &unit)
|
||||
{
|
||||
if (!unit.IsStopped())
|
||||
unit.StopMoving();
|
||||
|
||||
unit.addUnitState(UNIT_STAT_ROAMING|UNIT_STAT_ROAMING_MOVE);
|
||||
|
||||
Traveller<T> traveller(unit);
|
||||
i_destinationHolder.SetDestination(traveller, i_x, i_y, i_z);
|
||||
|
||||
|
|
@ -52,11 +55,12 @@ void PointMovementGenerator<T>::Interrupt(T &unit)
|
|||
template<class T>
|
||||
void PointMovementGenerator<T>::Reset(T &unit)
|
||||
{
|
||||
if (!unit.IsStopped())
|
||||
unit.StopMoving();
|
||||
|
||||
unit.addUnitState(UNIT_STAT_ROAMING|UNIT_STAT_ROAMING_MOVE);
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
bool PointMovementGenerator<T>::Update(T &unit, const uint32 &diff)
|
||||
{
|
||||
|
|
@ -70,6 +74,7 @@ bool PointMovementGenerator<T>::Update(T &unit, const uint32 &diff)
|
|||
}
|
||||
|
||||
unit.addUnitState(UNIT_STAT_ROAMING_MOVE);
|
||||
|
||||
Traveller<T> traveller(unit);
|
||||
if (i_destinationHolder.UpdateTraveller(traveller, diff, false))
|
||||
{
|
||||
|
|
@ -79,7 +84,7 @@ bool PointMovementGenerator<T>::Update(T &unit, const uint32 &diff)
|
|||
|
||||
if(i_destinationHolder.HasArrived())
|
||||
{
|
||||
unit.StopMoving();
|
||||
unit.clearUnitState(UNIT_STAT_ROAMING_MOVE);
|
||||
MovementInform(unit);
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "10419"
|
||||
#define REVISION_NR "10420"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue