X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FAIModel%2FAICarrier.cxx;h=e9aea5207d1f6337f7899fedbc6f2290d4b5b6e0;hb=afcdbd3158503773644aa07dd86cd92d67946bd4;hp=b6487519d026c05ea55bc026423f093d30ce9375;hpb=9626805a093fca9e94c5f11298e3c447caaef07d;p=flightgear.git diff --git a/src/AIModel/AICarrier.cxx b/src/AIModel/AICarrier.cxx index b6487519d..e9aea5207 100644 --- a/src/AIModel/AICarrier.cxx +++ b/src/AIModel/AICarrier.cxx @@ -26,12 +26,10 @@ #include #include -#include #include #include #include
-#include
#include "AICarrier.hxx" @@ -58,6 +56,8 @@ void FGAICarrier::readFromScenario(SGPropertyNode* scFileNode) { setMinLong(scFileNode->getDoubleValue("min-long", 0)); setMPControl(scFileNode->getBoolValue("mp-control", false)); setAIControl(scFileNode->getBoolValue("ai-control", false)); + setCallSign(scFileNode->getStringValue("callsign", "")); + SGPropertyNode* flols = scFileNode->getChild("flols-pos"); if (flols) { @@ -132,7 +132,7 @@ void FGAICarrier::update(double dt) { FGAIShip::update(dt); //automatic turn into wind with a target wind of 25 kts otd - //SG_LOG(SG_GENERAL, SG_ALERT, "AICarrier: MPControl " << MPControl << " AIControl " << AIControl); + //SG_LOG(SG_AI, SG_ALERT, "AICarrier: MPControl " << MPControl << " AIControl " << AIControl); if (!MPControl && AIControl){ if(turn_to_launch_hdg){ @@ -165,7 +165,7 @@ void FGAICarrier::update(double dt) { SGVec3d cartPos = SGVec3d::fromGeod(pos); // The position of the eyepoint - at least near that ... - SGVec3d eyePos(globals->get_current_view()->get_view_pos()); + SGVec3d eyePos(globals->get_view_position_cart()); // Add the position offset of the AIModel to gain the earth // centered position SGVec3d eyeWrtCarrier = eyePos - cartPos; @@ -245,64 +245,63 @@ void FGAICarrier::bind() { props->untie("velocities/true-airspeed-kt"); - props->tie("controls/flols/source-lights", - SGRawValuePointer(&source)); - props->tie("controls/flols/distance-m", - SGRawValuePointer(&dist)); - props->tie("controls/flols/angle-degs", - SGRawValuePointer(&angle)); - props->tie("controls/turn-to-launch-hdg", - SGRawValuePointer(&turn_to_launch_hdg)); - props->tie("controls/in-to-wind", - SGRawValuePointer(&turn_to_launch_hdg)); - props->tie("controls/base-course-deg", - SGRawValuePointer(&base_course)); - props->tie("controls/base-speed-kts", - SGRawValuePointer(&base_speed)); - props->tie("controls/start-pos-lat-deg", - SGRawValueMethods(pos, &SGGeod::getLatitudeDeg)); - props->tie("controls/start-pos-long-deg", - SGRawValueMethods(pos, &SGGeod::getLongitudeDeg)); - props->tie("controls/mp-control", - SGRawValuePointer(&MPControl)); - props->tie("controls/ai-control", - SGRawValuePointer(&AIControl)); - props->tie("environment/surface-wind-speed-true-kts", - SGRawValuePointer(&wind_speed_kts)); - props->tie("environment/surface-wind-from-true-degs", - SGRawValuePointer(&wind_from_deg)); - props->tie("environment/rel-wind-from-degs", - SGRawValuePointer(&rel_wind_from_deg)); - props->tie("environment/rel-wind-from-carrier-hdg-degs", - SGRawValuePointer(&rel_wind)); - props->tie("environment/rel-wind-speed-kts", - SGRawValuePointer(&rel_wind_speed_kts)); - props->tie("environment/in-to-wind", + tie("controls/flols/source-lights", + SGRawValuePointer(&source)); + tie("controls/flols/distance-m", + SGRawValuePointer(&dist)); + tie("controls/flols/angle-degs", + SGRawValuePointer(&angle)); + tie("controls/turn-to-launch-hdg", + SGRawValuePointer(&turn_to_launch_hdg)); + tie("controls/in-to-wind", + SGRawValuePointer(&turn_to_launch_hdg)); + tie("controls/base-course-deg", + SGRawValuePointer(&base_course)); + tie("controls/base-speed-kts", + SGRawValuePointer(&base_speed)); + tie("controls/start-pos-lat-deg", + SGRawValueMethods(pos, &SGGeod::getLatitudeDeg)); + tie("controls/start-pos-long-deg", + SGRawValueMethods(pos, &SGGeod::getLongitudeDeg)); + tie("controls/mp-control", + SGRawValuePointer(&MPControl)); + tie("controls/ai-control", + SGRawValuePointer(&AIControl)); + tie("environment/surface-wind-speed-true-kts", + SGRawValuePointer(&wind_speed_kts)); + tie("environment/surface-wind-from-true-degs", + SGRawValuePointer(&wind_from_deg)); + tie("environment/rel-wind-from-degs", + SGRawValuePointer(&rel_wind_from_deg)); + tie("environment/rel-wind-from-carrier-hdg-degs", + SGRawValuePointer(&rel_wind)); + tie("environment/rel-wind-speed-kts", + SGRawValuePointer(&rel_wind_speed_kts)); + tie("environment/in-to-wind", SGRawValuePointer(&in_to_wind)); - //props->tie("controls/flols/wave-off-lights", - // SGRawValuePointer(&wave_off_lights)); - props->tie("controls/elevators", - SGRawValuePointer(&elevators)); - props->tie("surface-positions/elevators-pos-norm", - SGRawValuePointer(&pos_norm)); - props->tie("controls/constants/elevators/trans-time-s", - SGRawValuePointer(&transition_time)); - props->tie("controls/constants/elevators/time-constant", - SGRawValuePointer(&time_constant)); - props->tie("controls/jbd", + //tie("controls/flols/wave-off-lights", + // SGRawValuePointer(&wave_off_lights)); + tie("controls/elevators", + SGRawValuePointer(&elevators)); + tie("surface-positions/elevators-pos-norm", + SGRawValuePointer(&pos_norm)); + tie("controls/constants/elevators/trans-time-s", + SGRawValuePointer(&transition_time)); + tie("controls/constants/elevators/time-constant", + SGRawValuePointer(&time_constant)); + tie("controls/jbd", SGRawValuePointer(&jbd)); - props->tie("surface-positions/jbd-pos-norm", + tie("surface-positions/jbd-pos-norm", SGRawValuePointer(&jbd_pos_norm)); - props->tie("controls/constants/jbd/trans-time-s", + tie("controls/constants/jbd/trans-time-s", SGRawValuePointer(&jbd_transition_time)); - props->tie("controls/constants/jbd/time-constant", + tie("controls/constants/jbd/time-constant", SGRawValuePointer(&jbd_time_constant)); - props->tie("controls/turn-to-recovery-hdg", + tie("controls/turn-to-recovery-hdg", SGRawValuePointer(&turn_to_recovery_hdg)); - props->tie("controls/turn-to-base-course", + tie("controls/turn-to-base-course", SGRawValuePointer(&turn_to_base_course)); - props->setBoolValue("controls/flols/cut-lights", false); props->setBoolValue("controls/flols/wave-off-lights", false); props->setBoolValue("controls/flols/cond-datum-lights", true); @@ -313,36 +312,6 @@ void FGAICarrier::bind() { props->setDoubleValue("controls/lighting/flood-lights-red-norm", 0); } - -void FGAICarrier::unbind() { - FGAIShip::unbind(); - - props->untie("velocities/true-airspeed-kt"); - props->untie("controls/flols/source-lights"); - props->untie("controls/flols/distance-m"); - props->untie("controls/flols/angle-degs"); - props->untie("controls/turn-to-launch-hdg"); - props->untie("environment/wind-speed-true-kts"); - props->untie("environment/wind-from-true-degs"); - props->untie("environment/rel-wind-from-degs"); - props->untie("environment/rel-wind-speed-kts"); - props->untie("environment/in-to-wind"); - //props->untie("controls/flols/wave-off-lights"); - props->untie("controls/elevators"); - props->untie("surface-positions/elevators-pos-norm"); - props->untie("controls/constants/elevators/trans-time-secs"); - props->untie("controls/constants/elevators/time-constant"); - props->untie("controls/jbd"); - props->untie("surface-positions/jbd/pos-norm"); - props->untie("controls/constants/jbd/trans-time-s"); - props->untie("controls/jbd-time-constant"); - props->untie("controls/mp-control"); - props->untie("controls/ai-control"); - props->untie("controls/turn-to-recovery-hdg"); - props->untie("controls/turn-to-base-course"); -} - - bool FGAICarrier::getParkPosition(const string& id, SGGeod& geodPos, double& hdng, SGVec3d& uvw) { @@ -494,7 +463,7 @@ void FGAICarrier::ReturnToBox(){ bool FGAICarrier::OutsideBox() { //returns true if the carrier is outside operating box if ( max_lat == 0 && min_lat == 0 && max_long == 0 && min_long == 0) { - SG_LOG(SG_GENERAL, SG_DEBUG, "AICarrier: No Operating Box defined" ); + SG_LOG(SG_AI, SG_DEBUG, "AICarrier: No Operating Box defined" ); return false; } @@ -528,7 +497,7 @@ bool FGAICarrier::OutsideBox() { //returns true if the carrier is outside operat return true; } - SG_LOG(SG_GENERAL, SG_DEBUG, "AICarrier: Inside Operating Box" ); + SG_LOG(SG_AI, SG_DEBUG, "AICarrier: Inside Operating Box" ); return false; } // end OutsideBox