diff --git a/src/strategy/actions/MoveToRpgTargetAction.cpp b/src/strategy/actions/MoveToRpgTargetAction.cpp index c2bf3446..9640fc5c 100644 --- a/src/strategy/actions/MoveToRpgTargetAction.cpp +++ b/src/strategy/actions/MoveToRpgTargetAction.cpp @@ -95,7 +95,7 @@ bool MoveToRpgTargetAction::Execute(Event event) x += cos(angle) * INTERACTION_DISTANCE * distance; y += sin(angle) * INTERACTION_DISTANCE * distance; if (!wo->GetMap()->CheckCollisionAndGetValidCoords(wo, wo->GetPositionX(), wo->GetPositionY(), wo->GetPositionZ(), - x, y, z, false)) + x, y, z)) { x = wo->GetPositionX(); y = wo->GetPositionY(); diff --git a/src/strategy/actions/MovementActions.cpp b/src/strategy/actions/MovementActions.cpp index bc933202..ea460bc1 100644 --- a/src/strategy/actions/MovementActions.cpp +++ b/src/strategy/actions/MovementActions.cpp @@ -820,7 +820,7 @@ bool MovementAction::ReachCombatTo(Unit* target, float distance) tx += targetMoveDist * cos(target->GetOrientation()); ty += targetMoveDist * sin(target->GetOrientation()); if (!target->GetMap()->CheckCollisionAndGetValidCoords(target, target->GetPositionX(), target->GetPositionY(), - target->GetPositionZ(), tx, ty, tz, false)) + target->GetPositionZ(), tx, ty, tz)) { // disable prediction if position is invalid tx = target->GetPositionX(); @@ -2357,10 +2357,15 @@ bool MoveRandomAction::Execute(Event event) float angle = (float)rand_norm() * static_cast(M_PI); x += urand(0, distance) * cos(angle); y += urand(0, distance) * sin(angle); + float ox = x; + float oy = y; + float oz = z; if (!bot->GetMap()->CheckCollisionAndGetValidCoords(bot, bot->GetPositionX(), bot->GetPositionY(), - bot->GetPositionZ(), x, y, z, false)) + bot->GetPositionZ(), x, y, z)) { - continue; + x = ox; + y = oy; + z = oz; } if (map->IsInWater(bot->GetPhaseMask(), x, y, z, bot->GetCollisionHeight())) continue;