diff --git a/src/ai/ai.cpp b/src/ai/ai.cpp index 37a9fbefea..6eb31d358a 100644 --- a/src/ai/ai.cpp +++ b/src/ai/ai.cpp @@ -52,7 +52,7 @@ void ShipAI::run(float delta) { owner->target_rotation = owner->getRotation(); owner->warp_request = 0.0; - owner->impulse_request = 0.0f; + owner->setImpulseRequest(0.0f); updateWeaponState(delta); if (update_target_delay > 0.0f) @@ -599,13 +599,13 @@ void ShipAI::flyTowards(glm::vec2 target, float keep_distance) keep_distance = 0.0; if (distance > keep_distance + owner->impulse_max_speed * 5.0f) - owner->impulse_request = 1.0f; + owner->setImpulseRequest(1.0f); else - owner->impulse_request = (distance - keep_distance) / owner->impulse_max_speed * 5.0f; + owner->setImpulseRequest((distance - keep_distance) / owner->impulse_max_speed * 5.0f); if (rotation_diff > 90) - owner->impulse_request = -owner->impulse_request; + owner->setImpulseRequest(-owner->impulse_request); else if (rotation_diff < 45) - owner->impulse_request *= 1.0f - ((rotation_diff - 45.0f) / 45.0f); + owner->setImpulseRequest(owner->impulse_request * (1.0f - ((rotation_diff - 45.0f) / 45.0f))); } } @@ -633,19 +633,19 @@ void ShipAI::flyFormation(P target, glm::vec2 offset) { float angle_diff = angleDifference(owner->target_rotation, owner->getRotation()); if (angle_diff > 10.0f) - owner->impulse_request = 0.0f; + owner->setImpulseRequest(0.0f); else if (angle_diff > 5.0f) - owner->impulse_request = (10.0f - angle_diff) / 5.0f; + owner->setImpulseRequest((10.0f - angle_diff) / 5.0f); else - owner->impulse_request = 1.0f; + owner->setImpulseRequest(1.0f); }else{ if (distance > r / 2.0f) { owner->target_rotation += angleDifference(owner->target_rotation, target->getRotation()) * (1.0f - distance / r); - owner->impulse_request = distance / r; + owner->setImpulseRequest(distance / r); }else{ owner->target_rotation = target->getRotation(); - owner->impulse_request = 0.0f; + owner->setImpulseRequest(0.0f); } } }else{ diff --git a/src/ai/fighterAI.cpp b/src/ai/fighterAI.cpp index 893d19d5b5..364ad26413 100644 --- a/src/ai/fighterAI.cpp +++ b/src/ai/fighterAI.cpp @@ -93,7 +93,7 @@ void FighterAI::runAttack(P target) else { owner->target_rotation = evade_direction; - owner->impulse_request = 1.0; + owner->setImpulseRequest(1.0f); } break; case recharge: