diff options
| author | Machiavelli <none@none> | 2010-06-19 17:26:12 +0200 |
|---|---|---|
| committer | Machiavelli <none@none> | 2010-06-19 17:26:12 +0200 |
| commit | 8c8986b2bc7a5dee3c12252486ad68a40a482ee0 (patch) | |
| tree | 0ffb64f293b409a10f898830515e3ee6e3dbe0a1 /src/server/game/Movement | |
| parent | 706c0568a5a7261bbc1839d771bd885a5842a116 (diff) | |
Fix usage of uninitialized waypoint array variables in ConfusedMovementGenerator<T>::Initialize and revert 9b1c565510+ad8ce5245e that covered up this problem without fixing it and introduced a faulty LOS calculation.
With thanks to Lynx3d and click, and Aokromes and ritchy for testing.
--HG--
branch : trunk
Diffstat (limited to 'src/server/game/Movement')
| -rw-r--r-- | src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp index 43c6052d2d3..c9e39866bf5 100644 --- a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp @@ -51,15 +51,13 @@ ConfusedMovementGenerator<T>::Initialize(T &unit) for (uint8 idx = 0; idx <= MAX_CONF_WAYPOINTS; ++idx) { + const float wanderX = wander_distance*rand_norm() - wander_distance/2; + const float wanderY = wander_distance*rand_norm() - wander_distance/2; + i_waypoints[idx][0] = x + wanderX; + i_waypoints[idx][1] = y + wanderY; + const bool isInLoS = vMaps->isInLineOfSight(unit.GetMapId(), x, y, z + 2.0f, i_waypoints[idx][0], i_waypoints[idx][1], z + 2.0f); - if (isInLoS) - { - const float wanderX = wander_distance*rand_norm() - wander_distance/2; - const float wanderY = wander_distance*rand_norm() - wander_distance/2; - i_waypoints[idx][0] = x + wanderX; - i_waypoints[idx][1] = y + wanderY; - } - else + if (!isInLoS) { i_waypoints[idx][0] = x; i_waypoints[idx][1] = y; |
