From ed6dee3f554b2072ff5a116889271dfebe5ac219 Mon Sep 17 00:00:00 2001 From: Henning Stahlke Date: Mon, 24 Apr 2017 18:31:03 +0200 Subject: [PATCH] YASim Airplane: add initalizers. --- src/FDM/YASim/Airplane.cpp | 20 --------------- src/FDM/YASim/Airplane.hpp | 52 +++++++++++++++++++------------------- 2 files changed, 26 insertions(+), 46 deletions(-) diff --git a/src/FDM/YASim/Airplane.cpp b/src/FDM/YASim/Airplane.cpp index 17768d575..d56c4e5f9 100644 --- a/src/FDM/YASim/Airplane.cpp +++ b/src/FDM/YASim/Airplane.cpp @@ -33,26 +33,6 @@ const float SOLVE_TWEAK = 0.3226; Airplane::Airplane() { - _emptyWeight = 0; - _pilotPos[0] = _pilotPos[1] = _pilotPos[2] = 0; - _wing = 0; - _tail = 0; - _ballast = 0; - _cruiseSpeed = 0; - _cruiseWeight = 0; - _cruiseGlideAngle = 0; - _approachSpeed = 0; - _approachAoA = 0; - _approachWeight = 0; - _approachGlideAngle = 0; - - _dragFactor = 1; - _liftRatio = 1; - _cruiseAoA = 0; - _tailIncidence = 0; - - _failureMsg = 0; - _wingsN = 0; } Airplane::~Airplane() diff --git a/src/FDM/YASim/Airplane.hpp b/src/FDM/YASim/Airplane.hpp index 671aca001..ef9dfefda 100644 --- a/src/FDM/YASim/Airplane.hpp +++ b/src/FDM/YASim/Airplane.hpp @@ -148,17 +148,17 @@ private: Model _model; ControlMap _controls; - float _emptyWeight; - float _pilotPos[3]; + float _emptyWeight {0}; + float _pilotPos[3] {0, 0, 0}; - Wing* _wing; - Wing* _tail; + Wing* _wing {nullptr}; + Wing* _tail {nullptr}; Vector _fuselages; Vector _vstabs; Vector _tanks; Vector _thrusters; - float _ballast; + float _ballast {0}; Vector _gears; Vector _contacts; // non-gear ground contact points @@ -171,34 +171,34 @@ private: Vector _cruiseControls; State _cruiseState; Atmosphere _cruiseAtmo; - float _cruiseSpeed; - float _cruiseWeight; - float _cruiseFuel; - float _cruiseGlideAngle; + float _cruiseSpeed{0}; + float _cruiseWeight{0}; + float _cruiseFuel{0}; + float _cruiseGlideAngle{0}; Vector _approachControls; State _approachState; Atmosphere _approachAtmo; - float _approachSpeed; - float _approachAoA; - float _approachWeight; - float _approachFuel; - float _approachGlideAngle; + float _approachSpeed {0}; + float _approachAoA {0}; + float _approachWeight {0}; + float _approachFuel {0}; + float _approachGlideAngle {0}; - int _solutionIterations; - float _dragFactor; - float _liftRatio; - float _cruiseAoA; - float _tailIncidence; + int _solutionIterations {0}; + float _dragFactor {1}; + float _liftRatio {1}; + float _cruiseAoA {0}; + float _tailIncidence {0}; Control _approachElevator; - const char* _failureMsg; + const char* _failureMsg {0}; - float _cgMax = -1e6; // hard limits for cg from gear position - float _cgMin = 1e6; // hard limits for cg from gear position - float _cgDesiredMax = 0.3f; // desired cg max in %MAC from config - float _cgDesiredMin = 0.25f; // desired cg min in %MAC from config - float _cgDesiredFront; // calculated desired cg x max - float _cgDesiredAft; // calculated desired cg x min + float _cgMax {-1e6}; // hard limits for cg from gear position + float _cgMin {1e6}; // hard limits for cg from gear position + float _cgDesiredMax {0.3f}; // desired cg max in %MAC from config + float _cgDesiredMin {0.25f}; // desired cg min in %MAC from config + float _cgDesiredFront {0}; // calculated desired cg x max + float _cgDesiredAft {0}; // calculated desired cg x min bool _autoBallast = false; };