-bool FGAICarrier::mark_cat(ssgEntity* e, const list<string>& cat_objects) {
- bool found = false;
- if (e->isAKindOf(ssgTypeBranch())) {
- ssgBranch* br = (ssgBranch*)e;
- ssgEntity* kid;
- for ( kid = br->getKid(0); kid != NULL ; kid = br->getNextKid() )
- found = mark_cat(kid, cat_objects) || found;
-
- if (found)
- br->setTraversalMaskBits(SSGTRAV_HOT);
-
- } else if (e->isAKindOf(ssgTypeLeaf())) {
- list<string>::const_iterator it;
- for (it = cat_objects.begin(); it != cat_objects.end(); ++it) {
- if (e->getName() && (*it) == e->getName()) {
- e->setTraversalMaskBits(SSGTRAV_HOT);
- e->setUserData( FGAICarrierHardware::newCatapult( this ) );
- ssgLeaf *l = (ssgLeaf*)e;
- if ( l->getNumLines() != 1 ) {
- SG_LOG(SG_GENERAL, SG_ALERT,
- "AICarrier: Found a cat not modelled with exactly one line!");
- }
- // Now some special code to make sure the cat points in the right
- // direction. The 0 index must be the backward end, the 1 index
- // the forward end.
- // Forward is positive x-direction in our 3D model, also the model
- // as such is flattened when it is loaded, so we do not need to care
- // for transforms ...
- short v[2];
- l->getLine(0, v, v+1 );
- sgVec3 ends[2];
- for (int k=0; k<2; ++k)
- sgCopyVec3( ends[k], l->getVertex( v[k] ) );
-
- // When the 1 end is behind the 0 end, swap the coordinates.
- if (ends[0][0] < ends[1][0]) {
- sgCopyVec3( l->getVertex( v[0] ), ends[1] );
- sgCopyVec3( l->getVertex( v[1] ), ends[0] );
+void FGAICarrier::bind() {
+ FGAIShip::bind();
+
+ props->untie("velocities/true-airspeed-kt");
+
+ tie("controls/flols/source-lights",
+ SGRawValuePointer<int>(&source));
+ tie("controls/flols/distance-m",
+ SGRawValuePointer<double>(&dist));
+ tie("controls/flols/angle-degs",
+ SGRawValuePointer<double>(&angle));
+ tie("controls/turn-to-launch-hdg",
+ SGRawValuePointer<bool>(&turn_to_launch_hdg));
+ tie("controls/in-to-wind",
+ SGRawValuePointer<bool>(&turn_to_launch_hdg));
+ tie("controls/base-course-deg",
+ SGRawValuePointer<double>(&base_course));
+ tie("controls/base-speed-kts",
+ SGRawValuePointer<double>(&base_speed));
+ tie("controls/start-pos-lat-deg",
+ SGRawValueMethods<SGGeod,double>(pos, &SGGeod::getLatitudeDeg));
+ tie("controls/start-pos-long-deg",
+ SGRawValueMethods<SGGeod,double>(pos, &SGGeod::getLongitudeDeg));
+ tie("controls/mp-control",
+ SGRawValuePointer<bool>(&MPControl));
+ tie("controls/ai-control",
+ SGRawValuePointer<bool>(&AIControl));
+ tie("environment/surface-wind-speed-true-kts",
+ SGRawValuePointer<double>(&wind_speed_kts));
+ tie("environment/surface-wind-from-true-degs",
+ SGRawValuePointer<double>(&wind_from_deg));
+ tie("environment/rel-wind-from-degs",
+ SGRawValuePointer<double>(&rel_wind_from_deg));
+ tie("environment/rel-wind-from-carrier-hdg-degs",
+ SGRawValuePointer<double>(&rel_wind));
+ tie("environment/rel-wind-speed-kts",
+ SGRawValuePointer<double>(&rel_wind_speed_kts));
+ tie("environment/in-to-wind",
+ SGRawValuePointer<bool>(&in_to_wind));
+ //tie("controls/flols/wave-off-lights",
+ // SGRawValuePointer<bool>(&wave_off_lights));
+ tie("controls/elevators",
+ SGRawValuePointer<bool>(&elevators));
+ tie("surface-positions/elevators-pos-norm",
+ SGRawValuePointer<double>(&pos_norm));
+ tie("controls/constants/elevators/trans-time-s",
+ SGRawValuePointer<double>(&transition_time));
+ tie("controls/constants/elevators/time-constant",
+ SGRawValuePointer<double>(&time_constant));
+ tie("controls/jbd",
+ SGRawValuePointer<bool>(&jbd));
+ tie("surface-positions/jbd-pos-norm",
+ SGRawValuePointer<double>(&jbd_pos_norm));
+ tie("controls/constants/jbd/trans-time-s",
+ SGRawValuePointer<double>(&jbd_transition_time));
+ tie("controls/constants/jbd/time-constant",
+ SGRawValuePointer<double>(&jbd_time_constant));
+ tie("controls/turn-to-recovery-hdg",
+ SGRawValuePointer<bool>(&turn_to_recovery_hdg));
+ tie("controls/turn-to-base-course",
+ SGRawValuePointer<bool>(&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);
+ props->setBoolValue("controls/crew", false);
+ props->setStringValue("navaids/tacan/channel-ID", TACAN_channel_id.c_str());
+ props->setStringValue("sign", sign.c_str());
+ props->setBoolValue("controls/lighting/deck-lights", false);
+ props->setDoubleValue("controls/lighting/flood-lights-red-norm", 0);
+}
+
+bool FGAICarrier::getParkPosition(const string& id, SGGeod& geodPos,
+ double& hdng, SGVec3d& uvw)
+{
+
+ // FIXME: does not yet cover rotation speeds.
+ list<ParkPosition>::iterator it = ppositions.begin();
+ while (it != ppositions.end()) {
+ // Take either the specified one or the first one ...
+ if ((*it).name == id || id.empty()) {
+ ParkPosition ppos = *it;
+ SGVec3d cartPos = getCartPosAt(ppos.offset);
+ geodPos = SGGeod::fromCart(cartPos);
+ hdng = hdg + ppos.heading_deg;
+ double shdng = sin(ppos.heading_deg * SGD_DEGREES_TO_RADIANS);
+ double chdng = cos(ppos.heading_deg * SGD_DEGREES_TO_RADIANS);
+ double speed_fps = speed*1.6878099;
+ uvw = SGVec3d(chdng*speed_fps, shdng*speed_fps, 0);
+ return true;