[11782] fix the issue in FlightPathMovementGenerator that event for last path point was not processed

This commit is contained in:
SilverIce 2011-09-02 14:02:26 +03:00
parent de54e63f7a
commit 7c49e4afb6
3 changed files with 13 additions and 10 deletions

View file

@ -313,15 +313,20 @@ void FlightPathMovementGenerator::Reset(Player & player)
bool FlightPathMovementGenerator::Update(Player &player, const uint32 &diff) bool FlightPathMovementGenerator::Update(Player &player, const uint32 &diff)
{ {
uint32 pointId = (uint32)player.movespline->currentPathIdx(); uint32 pointId = (uint32)player.movespline->currentPathIdx();
// currentPathIdx returns lastIdx + 1 at arrive if (pointId > i_currentNode)
while (i_currentNode < pointId)
{ {
DoEventIfAny(player,(*i_path)[i_currentNode],true); bool departureEvent = true;
DoEventIfAny(player,(*i_path)[i_currentNode],false); do
++i_currentNode; {
DoEventIfAny(player,(*i_path)[i_currentNode],departureEvent);
if (pointId == i_currentNode)
break;
i_currentNode += (uint32)departureEvent;
departureEvent = !departureEvent;
} while(true);
} }
return MovementInProgress(); return i_currentNode < (i_path->size()-1);
} }
void FlightPathMovementGenerator::SetCurrentNodeAfterTeleport() void FlightPathMovementGenerator::SetCurrentNodeAfterTeleport()

View file

@ -43,8 +43,6 @@ class MANGOS_DLL_SPEC PathMovementBase
PathMovementBase() : i_currentNode(0) {} PathMovementBase() : i_currentNode(0) {}
virtual ~PathMovementBase() {}; virtual ~PathMovementBase() {};
bool MovementInProgress(void) const { return (i_currentNode+1) < i_path->size(); }
// template pattern, not defined .. override required // template pattern, not defined .. override required
void LoadPath(T &); void LoadPath(T &);
uint32 GetCurrentNode() const { return i_currentNode; } uint32 GetCurrentNode() const { return i_currentNode; }

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "11781" #define REVISION_NR "11782"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__