mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[9434] Prevent crash at script call that modify movegen list at MovementInform call.
This commit is contained in:
parent
244d25189c
commit
f47f5a1deb
3 changed files with 14 additions and 3 deletions
|
|
@ -206,6 +206,17 @@ 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)
|
||||
return true; // not expire now, but already lost
|
||||
|
||||
// prevent a crash at empty waypoint path.
|
||||
if (!i_path || i_path->empty())
|
||||
{
|
||||
creature.clearUnitState(UNIT_STAT_ROAMING_MOVE);
|
||||
return true;
|
||||
}
|
||||
} // HasDone == false
|
||||
} // i_creature.IsStopped()
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ class MANGOS_DLL_SPEC WaypointMovementGenerator;
|
|||
template<>
|
||||
class MANGOS_DLL_SPEC WaypointMovementGenerator<Creature>
|
||||
: public MovementGeneratorMedium< Creature, WaypointMovementGenerator<Creature> >,
|
||||
public PathMovementBase<Creature, WaypointPath*>
|
||||
public PathMovementBase<Creature, WaypointPath const*>
|
||||
{
|
||||
public:
|
||||
WaypointMovementGenerator(Creature &) : i_nextMoveTime(0), b_StoppedByPlayer(false) {}
|
||||
|
|
@ -95,7 +95,7 @@ public PathMovementBase<Creature, WaypointPath*>
|
|||
void SetStoppedByPlayer(bool val) { b_StoppedByPlayer = val; }
|
||||
|
||||
// allow use for overwrite empty implementation
|
||||
bool GetDestination(float& x, float& y, float& z) const { return PathMovementBase<Creature, WaypointPath*>::GetDestination(x,y,z); }
|
||||
bool GetDestination(float& x, float& y, float& z) const { return PathMovementBase<Creature, WaypointPath const*>::GetDestination(x,y,z); }
|
||||
|
||||
private:
|
||||
void ClearWaypoints();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "9433"
|
||||
#define REVISION_NR "9434"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue