fix(Core): Crashfix. (#14667)
This commit is contained in:
@@ -134,6 +134,11 @@ void RandomMovementGenerator<Creature>::_setRandomLocation(Creature* creature)
|
|||||||
}
|
}
|
||||||
else // ground
|
else // ground
|
||||||
{
|
{
|
||||||
|
if (!_pathGenerator)
|
||||||
|
_pathGenerator = new PathGenerator(creature);
|
||||||
|
else
|
||||||
|
_pathGenerator->Clear();
|
||||||
|
|
||||||
bool result = _pathGenerator->CalculatePath(x, y, levelZ, false);
|
bool result = _pathGenerator->CalculatePath(x, y, levelZ, false);
|
||||||
if (result && !(_pathGenerator->GetPathType() & PATHFIND_NOPATH))
|
if (result && !(_pathGenerator->GetPathType() & PATHFIND_NOPATH))
|
||||||
{
|
{
|
||||||
@@ -252,8 +257,6 @@ void RandomMovementGenerator<Creature>::DoInitialize(Creature* creature)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_pathGenerator)
|
|
||||||
_pathGenerator = new PathGenerator(creature);
|
|
||||||
creature->AddUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE);
|
creature->AddUnitState(UNIT_STATE_ROAMING | UNIT_STATE_ROAMING_MOVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user