aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkaelima <kaelima@live.se>2012-04-09 15:00:52 +0200
committerkaelima <kaelima@live.se>2012-04-09 15:00:52 +0200
commit1f1e243bfa490ff32d8b047793d48d09cad14405 (patch)
tree3681b65c2d90bb51438035bd3b37795446fa04e7 /src
parent4c961ff393da427e023f83fe6bb9b645e5f5c1ff (diff)
Core/Movement: Fix some issues with ConfusedMovementGenerator from recent changes.
- Z position was not set if LOS-check failed, and thereafter causing a crash when trying to move to a uninitialized z-choord. - Also fixes bad coords in water Closes #6124
Diffstat (limited to 'src')
-rwxr-xr-xsrc/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp
index 03bc2570c0c..54a68f92c66 100755
--- a/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp
+++ b/src/server/game/Movement/MovementGenerators/ConfusedMovementGenerator.cpp
@@ -59,24 +59,24 @@ void ConfusedMovementGenerator<T>::Initialize(T &unit)
if ((is_water && !is_water_ok) || (!is_water && !is_land_ok))
{
- //! Ignore bad generated path. Use the current or previous position.
- i_waypoints[idx][0] = idx > 0 ? i_waypoints[idx-1][0] : x;
- i_waypoints[idx][1] = idx > 0 ? i_waypoints[idx-1][1] : y;
+ //! Cannot use coordinates outside our InhabitType. Use the current or previous position.
+ wanderX = idx > 0 ? i_waypoints[idx-1][0] : x;
+ wanderY = idx > 0 ? i_waypoints[idx-1][1] : y;
}
-
- unit.UpdateAllowedPositionZ(wanderX, wanderY, z);
-
- //! Positions are now fine - apply them to this waypoint
- i_waypoints[idx][0] = wanderX;
- i_waypoints[idx][1] = wanderY;
- i_waypoints[idx][2] = z;
}
else
{
- //! Ignore bad generated path. Use the current or previous position.
- i_waypoints[idx][0] = idx > 0 ? i_waypoints[idx-1][0] : x;
- i_waypoints[idx][1] = idx > 0 ? i_waypoints[idx-1][1] : y;
+ //! Trying to access path outside line of sight. Skip this by using the current or previous position.
+ wanderX = idx > 0 ? i_waypoints[idx-1][0] : x;
+ wanderY = idx > 0 ? i_waypoints[idx-1][1] : y;
}
+
+ unit.UpdateAllowedPositionZ(wanderX, wanderY, z);
+
+ //! Positions are fine - apply them to this waypoint
+ i_waypoints[idx][0] = wanderX;
+ i_waypoints[idx][1] = wanderY;
+ i_waypoints[idx][2] = z;
}
unit.StopMoving();