| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
#pragma once |
| 10 |
|
| 11 |
#include <string> |
| 12 |
#include <string_view> |
| 13 |
#include <utility> |
| 14 |
|
| 15 |
#include "AIBaseAircraft.hxx" |
| 16 |
|
| 17 |
|
| 18 |
struct AircraftTransponder { |
| 19 |
AircraftTransponder(std::string callsign, int code, bool modeC, bool ident) |
| 20 |
: callsign(std::move(callsign)), code(code), modeC(modeC), ident(ident) |
| 21 |
{ |
| 22 |
} |
| 23 |
|
| 24 |
std::string callsign; |
| 25 |
int code; |
| 26 |
bool modeC; |
| 27 |
bool ident; |
| 28 |
}; |
| 29 |
|
| 30 |
struct AircraftSurfaces { |
| 31 |
AircraftSurfaces(std::string callsign, double gear, double flaps, double spoilers, double speedBrake, double slats, double wingSweeps, |
| 32 |
double thrust, double elevator, double rudder, double aileron, bool landingLight, bool taxiLight, bool beaconLight, |
| 33 |
bool strobeLight, bool navLight, int lightPattern) |
| 34 |
: callsign(std::move(callsign)), gear(gear), flaps(flaps), spoilers(spoilers), speedBrake(speedBrake), slats(slats), wingSweeps(wingSweeps), |
| 35 |
thrust(thrust), elevator(elevator), rudder(rudder), aileron(aileron), landingLight(landingLight), taxiLight(taxiLight), beaconLight(beaconLight), |
| 36 |
strobeLight(strobeLight), navLight(navLight), lightPattern(lightPattern) {} |
| 37 |
|
| 38 |
std::string callsign; |
| 39 |
double gear; |
| 40 |
double flaps; |
| 41 |
double spoilers; |
| 42 |
double speedBrake; |
| 43 |
double slats; |
| 44 |
double wingSweeps; |
| 45 |
double thrust; |
| 46 |
double elevator; |
| 47 |
double rudder; |
| 48 |
double aileron; |
| 49 |
bool landingLight; |
| 50 |
bool taxiLight; |
| 51 |
bool beaconLight; |
| 52 |
bool strobeLight; |
| 53 |
bool navLight; |
| 54 |
int lightPattern; |
| 55 |
}; |
| 56 |
|
| 57 |
class FGAISwiftAircraft : public FGAIBaseAircraft |
| 58 |
{ |
| 59 |
public: |
| 60 |
FGAISwiftAircraft(const std::string& callsign, const std::string& modelString); |
| 61 |
virtual ~FGAISwiftAircraft() = default; |
| 62 |
|
| 63 |
std::string_view getTypeString() const override { return "swift"; } |
| 64 |
void update(double dt) override; |
| 65 |
|
| 66 |
void updatePosition(const SGGeod& position, const SGVec3d& orientation, double groundspeed, bool initPos); |
| 67 |
double getGroundElevation(const SGGeod& pos) const; |
| 68 |
void initProps(); |
| 69 |
void setPlaneSurface(const AircraftSurfaces& surfaces); |
| 70 |
void setPlaneTransponder(const AircraftTransponder& transponder); |
| 71 |
|
| 72 |
private: |
| 73 |
bool m_initPos = false; |
| 74 |
|
| 75 |
SGPropertyNode_ptr m_transponderCodeNode; |
| 76 |
SGPropertyNode_ptr m_transponderCModeNode; |
| 77 |
SGPropertyNode_ptr m_transponderIdentNode; |
| 78 |
}; |