From 55f9c240525d77686d00d43f627db7892f27e1de Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 20 Oct 2013 11:20:16 +0000 Subject: Allow docking even if ControlFlagOverride is set. --- src/game/base/ship.cc | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/src/game/base/ship.cc b/src/game/base/ship.cc index bc2b318..75656dc 100644 --- a/src/game/base/ship.cc +++ b/src/game/base/ship.cc @@ -646,7 +646,7 @@ void Ship::frame(const unsigned long elapsed) /* -- autopilot -------------------------------------------- */ - if (has_autopilot_flag(Ship::AutoPilotEnabled) && !has_target_controlflag(core::EntityControlable::ControlFlagOverride)) { + if (has_autopilot_flag(Ship::AutoPilotEnabled)) { if ((state() == core::Entity::Normal) || (state() == core::Entity::Impulse) || (state() == core::Entity::ImpulseInitiate)) { frame_autopilot(elapsed); @@ -1037,15 +1037,23 @@ void Ship::frame_autopilot(const unsigned long elapsed) const float distance = math::distance(location(), autopilot_target()->location()); const float dock_distance = (autopilot_target()->moduletype() == planet_enttype ? r + PLANET_SAFE_DISTANCE : r); - // thruster and speed control - if (has_autopilot_flag(AutoPilotFormation) && (distance < 4.0f * r)) { - frame_autopilot_formation(elapsed, autopilot_target()); - - } else if (has_autopilot_flag(AutoPilotDock) && (distance < dock_distance)) { - frame_autopilot_dock(elapsed, autopilot_target()); - + if (!has_target_controlflag(core::EntityControlable::ControlFlagOverride)) { + + // thruster and speed control + if (has_autopilot_flag(AutoPilotFormation) && (distance < 4.0f * r)) { + frame_autopilot_formation(elapsed, autopilot_target()); + + } else if (has_autopilot_flag(AutoPilotDock) && (distance < dock_distance)) { + frame_autopilot_dock(elapsed, autopilot_target()); + + } else { + frame_autopilot_goto(elapsed, autopilot_target()); + } } else { - frame_autopilot_goto(elapsed, autopilot_target()); + // docking has to work even if ControlFlagOverride is set + if (has_autopilot_flag(AutoPilotDock) && (distance < dock_distance)) { + frame_autopilot_dock(elapsed, autopilot_target()); + } } } -- cgit v1.2.3