mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 13:37:00 +00:00
[9445] Possible fix often crashes in waypoint movegen.
Thanks to DrKLO for research source of problem!
This commit is contained in:
parent
24f2d4658f
commit
87b08b4fa1
8 changed files with 35 additions and 8 deletions
|
|
@ -129,7 +129,11 @@ bool WaypointMovementGenerator<Creature>::Update(Creature &creature, const uint3
|
|||
CreatureTraveller traveller(creature);
|
||||
|
||||
i_nextMoveTime.Update(diff);
|
||||
i_destinationHolder.UpdateTraveller(traveller, diff, false, true);
|
||||
if (i_destinationHolder.UpdateTraveller(traveller, diff, false, true))
|
||||
{
|
||||
if (!IsActive(creature)) // force stop processing (movement can move out active zone with cleanup movegens list)
|
||||
return true; // not expire now, but already lost
|
||||
}
|
||||
|
||||
// creature has been stopped in middle of the waypoint segment
|
||||
if (!i_destinationHolder.HasArrived() && creature.IsStopped())
|
||||
|
|
@ -206,12 +210,11 @@ bool WaypointMovementGenerator<Creature>::Update(Creature &creature, const uint3
|
|||
i_hasDone[idx] = true;
|
||||
MovementInform(creature);
|
||||
|
||||
// force stop processing (script change movegen list)
|
||||
if (creature.GetMotionMaster()->empty() || creature.GetMotionMaster()->top() != this)
|
||||
if (!IsActive(creature)) // force stop processing (movement can move out active zone with cleanup movegens list)
|
||||
return true; // not expire now, but already lost
|
||||
|
||||
// prevent a crash at empty waypoint path.
|
||||
if (!i_path || i_path->empty())
|
||||
if (!i_path || i_path->empty() || i_currentNode >= i_path->size())
|
||||
{
|
||||
creature.clearUnitState(UNIT_STAT_ROAMING_MOVE);
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue