| 1 | /* |
| 2 | * SPDX-FileName: AIBaseAircraft.cxx |
| 3 | * SPDX-FileComment: abstract base class for AI aircraft |
| 4 | * SPDX-FileCopyrightText: Written by Stuart Buchanan, started August 2002 |
| 5 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 6 | */ |
| 7 | |
| 8 | #include "AIBaseAircraft.hxx" |
| 9 | |
| 10 | #include <Main/globals.hxx> |
| 11 | |
| 12 | FGAIBaseAircraft::FGAIBaseAircraft(object_type ot) : FGAIBase(ot, false), |
| 13 | m_gearPos(0.0), |
| 14 | m_flapsPos(0.0), |
| 15 | m_spoilerPos(0.0), |
| 16 | m_speedbrakePos(0.0), |
| 17 | m_beaconLight(false), |
| 18 | m_cabinLight(false), |
| 19 | m_landingLight(false), |
| 20 | m_navLight(false), |
| 21 | m_strobeLight(false), |
| 22 | m_taxiLight(false) |
| 23 | { |
| 24 | } |
| 25 | |
| 26 | void FGAIBaseAircraft::bind() |
| 27 | { |
| 28 | FGAIBase::bind(); |
| 29 | |
| 30 | // All gear positions are linked for simplicity |
| 31 | tie("gear/gear[0]/position-norm", SGRawValuePointer<double>(&m_gearPos)); |
| 32 | tie("gear/gear[1]/position-norm", SGRawValuePointer<double>(&m_gearPos)); |
| 33 | tie("gear/gear[2]/position-norm", SGRawValuePointer<double>(&m_gearPos)); |
| 34 | tie("gear/gear[3]/position-norm", SGRawValuePointer<double>(&m_gearPos)); |
| 35 | tie("gear/gear[4]/position-norm", SGRawValuePointer<double>(&m_gearPos)); |
| 36 | tie("gear/gear[5]/position-norm", SGRawValuePointer<double>(&m_gearPos)); |
| 37 | |
| 38 | tie("surface-positions/flap-pos-norm", |
| 39 | SGRawValueMethods<FGAIBaseAircraft, double>(*this, |
| 40 | &FGAIBaseAircraft::FlapsPos, |
| 41 | &FGAIBaseAircraft::FlapsPos)); |
| 42 | |
| 43 | tie("surface-positions/spoiler-pos-norm", |
| 44 | SGRawValueMethods<FGAIBaseAircraft, double>(*this, |
| 45 | &FGAIBaseAircraft::SpoilerPos, |
| 46 | &FGAIBaseAircraft::SpoilerPos)); |
| 47 | |
| 48 | tie("surface-positions/speedbrake-pos-norm", |
| 49 | SGRawValueMethods<FGAIBaseAircraft, double>(*this, |
| 50 | &FGAIBaseAircraft::SpeedBrakePos, |
| 51 | &FGAIBaseAircraft::SpeedBrakePos)); |
| 52 | |
| 53 | tie("controls/lighting/beacon", |
| 54 | SGRawValueMethods<FGAIBaseAircraft, bool>(*this, |
| 55 | &FGAIBaseAircraft::BeaconLight, |
| 56 | &FGAIBaseAircraft::BeaconLight)); |
| 57 | |
| 58 | tie("controls/lighting/cabin-lights", |
| 59 | SGRawValueMethods<FGAIBaseAircraft, bool>(*this, |
| 60 | &FGAIBaseAircraft::CabinLight, |
| 61 | &FGAIBaseAircraft::CabinLight)); |
| 62 | |
| 63 | tie("controls/lighting/landing-lights", |
| 64 | SGRawValueMethods<FGAIBaseAircraft, bool>(*this, |
| 65 | &FGAIBaseAircraft::LandingLight, |
| 66 | &FGAIBaseAircraft::LandingLight)); |
| 67 | |
| 68 | tie("controls/lighting/nav-lights", |
| 69 | SGRawValueMethods<FGAIBaseAircraft, bool>(*this, |
| 70 | &FGAIBaseAircraft::NavLight, |
| 71 | &FGAIBaseAircraft::NavLight)); |
| 72 | |
| 73 | tie("controls/lighting/strobe", |
| 74 | SGRawValueMethods<FGAIBaseAircraft, bool>(*this, |
| 75 | &FGAIBaseAircraft::StrobeLight, |
| 76 | &FGAIBaseAircraft::StrobeLight)); |
| 77 | |
| 78 | tie("controls/lighting/taxi-lights", |
| 79 | SGRawValueMethods<FGAIBaseAircraft, bool>(*this, |
| 80 | &FGAIBaseAircraft::TaxiLight, |
| 81 | &FGAIBaseAircraft::TaxiLight)); |
| 82 | } |