diff --git a/src/ai/ai.cpp b/src/ai/ai.cpp index b97259340a..2afdfed963 100644 --- a/src/ai/ai.cpp +++ b/src/ai/ai.cpp @@ -381,7 +381,7 @@ void ShipAI::runOrders() }else{ auto diff = owner->getOrderTargetLocation() - owner->getPosition(); if (glm::length2(diff) < 1000.0f*1000.0f) - owner->orderRoamingAt(glm::vec2(random(-long_range, long_range), random(-long_range, long_range))); + owner->orderRoamingAt(owner->getPosition() + glm::vec2(random(-long_range, long_range), random(-long_range, long_range))); flyTowards(owner->getOrderTargetLocation()); } }else if (owner->weapon_tube_count > 0) @@ -394,7 +394,7 @@ void ShipAI::runOrders() }else{ auto diff = owner->getOrderTargetLocation() - owner->getPosition(); if (glm::length2(diff) < 1000.0f*1000.0f) - owner->orderRoamingAt(glm::vec2(random(-long_range, long_range), random(-long_range, long_range))); + owner->orderRoamingAt(owner->getPosition() + glm::vec2(random(-long_range, long_range), random(-long_range, long_range))); flyTowards(owner->getOrderTargetLocation()); } }else{ diff --git a/src/spaceObjects/cpuShip.cpp b/src/spaceObjects/cpuShip.cpp index d6b4b8bf07..2219d2404f 100644 --- a/src/spaceObjects/cpuShip.cpp +++ b/src/spaceObjects/cpuShip.cpp @@ -202,7 +202,7 @@ void CpuShip::orderRoaming() target_rotation = getRotation(); orders = AI_Roaming; order_target = NULL; - order_target_location = glm::vec2(0, 0); + order_target_location = getPosition(); this->addBroadcast(FVF_Friendly, tr("cpulog", "Searching for targets.")); }