Created
February 13, 2012 17:44
-
-
Save sixsixnine/1818568 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/game/RandomMovementGenerator.cpp b/src/game/RandomMovementGenerator.cpp | |
index 40684d1..f4d1a1e 100644 | |
--- a/src/game/RandomMovementGenerator.cpp | |
+++ b/src/game/RandomMovementGenerator.cpp | |
@@ -40,8 +40,17 @@ void RandomMovementGenerator<Creature>::_setRandomLocation(Creature &creature) | |
creature.addUnitState(UNIT_STAT_ROAMING_MOVE); | |
+ PathFinder path(&creature); | |
+ path.setPathLengthLimit(30.0f); | |
+ path.calculate(destX, destY, destZ); | |
+ if(path.getPathType() & PATHFIND_NOPATH) | |
+ { | |
+ i_nextMoveTime.Reset(urand(500, 1000)); | |
+ return; | |
+ } | |
+ | |
Movement::MoveSplineInit init(creature); | |
- init.MoveTo(destX, destY, destZ, true); | |
+ init.MovebyPath(path.getPath()); | |
init.SetWalk(true); | |
init.Launch(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment