1
0
Fork 0

Maintenance: AIModel

Improve inheritance/polymorphism by eliminating shadow methods.
This commit is contained in:
Scott Giese 2021-02-21 23:18:15 -06:00
parent 7ee64f9994
commit 190aad784b
12 changed files with 58 additions and 71 deletions

View file

@ -38,11 +38,11 @@ public:
FGAIAircraft(FGAISchedule *ref=0);
~FGAIAircraft();
virtual void readFromScenario(SGPropertyNode* scFileNode);
void readFromScenario(SGPropertyNode* scFileNode) override;
virtual void bind();
virtual void update(double dt);
virtual void unbind();
void bind() override;
void update(double dt) override;
void unbind() override;
void setPerformance(const std::string& acType, const std::string& perfString);
@ -82,7 +82,7 @@ public:
void setTakeOffStatus(int status) { takeOffStatus = status; };
void scheduleForATCTowerDepartureControl(int state);
virtual const char* getTypeString(void) const { return "aircraft"; }
const char* getTypeString(void) const override { return "aircraft"; }
const std::string& GetTransponderCode() { return transponderCode; };
void SetTransponderCode(const std::string& tc) { transponderCode = tc;};

View file

@ -38,14 +38,14 @@ public:
FGAIBallistic(object_type ot = otBallistic);
~FGAIBallistic();
void readFromScenario(SGPropertyNode* scFileNode);
void readFromScenario(SGPropertyNode* scFileNode) override;
bool init(ModelSearchOrder searchOrder) override;
virtual void bind();
virtual void reinit();
virtual void update(double dt);
void bind() override;
void reinit() override;
void update(double dt) override;
virtual const char* getTypeString(void) const { return "ballistic"; }
const char* getTypeString(void) const override { return "ballistic"; }
void Run(double dt);

View file

@ -43,14 +43,14 @@ public:
FGAICarrier();
virtual ~FGAICarrier();
virtual void readFromScenario(SGPropertyNode* scFileNode);
void readFromScenario(SGPropertyNode* scFileNode) override;
void setSign(const string& );
void setDeckAltitude(const double altitude_feet);
void setTACANChannelID(const string &);
virtual double getDefaultModelRadius() { return 350.0; }
double getDefaultModelRadius() override { return 350.0; }
virtual void bind();
void bind() override;
void UpdateWind ( double dt );
void setWind_from_east( double fps );
void setWind_from_north( double fps );
@ -68,7 +68,7 @@ public:
bool init(ModelSearchOrder searchOrder) override;
virtual const char* getTypeString(void) const { return "carrier"; }
const char* getTypeString(void) const override { return "carrier"; }
bool getParkPosition(const string& id, SGGeod& geodPos,
double& hdng, SGVec3d& uvw);
@ -106,15 +106,12 @@ private:
double heading_deg;
};
void update(double dt);
void update(double dt) override;
double wind_from_east; // fps
double wind_from_north; // fps
double rel_wind_speed_kts;
double rel_wind_from_deg;
list<ParkPosition> ppositions; // List of positions where an aircraft can start.
string sign; // The sign of this carrier.

View file

@ -38,14 +38,14 @@ public:
FGAIEscort();
virtual ~FGAIEscort();
virtual void readFromScenario(SGPropertyNode* scFileNode);
void readFromScenario(SGPropertyNode* scFileNode) override;
bool init(ModelSearchOrder searchOrder) override;
virtual void bind();
virtual void reinit();
virtual void update (double dt);
void bind() override;
void reinit() override;
void update(double dt) override;
virtual const char* getTypeString(void) const { return "escort"; }
const char* getTypeString(void) const override { return "escort"; }
private:
void setStnRange(double r);

View file

@ -36,17 +36,16 @@ public:
FGAIGroundVehicle();
virtual ~FGAIGroundVehicle();
virtual void readFromScenario(SGPropertyNode* scFileNode);
void readFromScenario(SGPropertyNode* scFileNode) override;
bool init(ModelSearchOrder searchOrder) override;
virtual void bind();
virtual void reinit();
virtual void update (double dt);
void bind() override;
void reinit() override;
void update(double dt) override;
virtual const char* getTypeString(void) const { return "groundvehicle"; }
const char* getTypeString(void) const override { return "groundvehicle"; }
private:
void setNoRoll(bool nr);
void setContactX1offset(double x1);
void setContactX2offset(double x2);

View file

@ -33,8 +33,8 @@ public:
virtual ~FGAIMultiplayer();
bool init(ModelSearchOrder searchOrder) override;
virtual void bind();
virtual void update(double dt);
void bind() override;
void update(double dt) override;
void addMotionInfo(FGExternalMotionData& motionInfo, long stamp);
void setDoubleProperty(const std::string& prop, double val);
@ -75,7 +75,7 @@ public:
void clearMotionInfo();
virtual const char* getTypeString(void) const { return "multiplayer"; }
const char* getTypeString(void) const override { return "multiplayer"; }
private:

View file

@ -31,17 +31,16 @@ class FGAIManager;
class FGAIShip : public FGAIBase {
public:
FGAIShip(object_type ot = otShip);
virtual ~FGAIShip();
virtual void readFromScenario(SGPropertyNode* scFileNode);
void readFromScenario(SGPropertyNode* scFileNode) override;
bool init(ModelSearchOrder searchOrder) override;
virtual void bind();
virtual void update(double dt);
virtual void reinit();
virtual double getDefaultModelRadius() { return 200.0; }
void bind() override;
void update(double dt) override;
void reinit() override;
double getDefaultModelRadius() override { return 200.0; }
void setRudder(float r);
void setRoll(double rl);
@ -78,7 +77,7 @@ public:
bool _tunnel, _initial_tunnel;
bool _restart;
virtual const char* getTypeString(void) const { return "ship"; }
const char* getTypeString(void) const override { return "ship"; }
double _rudder_constant, _speed_constant, _hdg_constant, _limit ;
double _elevation_m, _elevation_ft;
double _missed_range, _tow_angle, _wait_count, _missed_count,_wp_range;
@ -91,8 +90,6 @@ public:
protected:
private:
void setRepeat(bool r);
void setRestart(bool r);
void setMissed(bool m);
@ -136,7 +133,6 @@ private:
bool _repeat;
bool _fp_init;
bool _missed;
};

View file

@ -32,14 +32,12 @@ class FGAIStatic : public FGAIBase {
public:
FGAIStatic();
~FGAIStatic();
FGAIStatic();
~FGAIStatic();
virtual void update(double dt);
void update(double dt) override;
virtual const char* getTypeString(void) const { return "static"; }
const char* getTypeString(void) const override { return "static"; }
};
#endif // _FG_AISTATIC_HXX

View file

@ -32,12 +32,12 @@ class FGAIStorm : public FGAIBase {
public:
FGAIStorm();
~FGAIStorm();
void readFromScenario(SGPropertyNode* scFileNode);
FGAIStorm();
~FGAIStorm();
virtual void update(double dt);
void readFromScenario(SGPropertyNode* scFileNode) override;
void update(double dt) override;
inline void setStrengthNorm( double s ) { strength_norm = s; };
inline void setDiameter( double d ) { diameter = d; };
inline void setHeight( double h ) { height = h; };
@ -45,14 +45,13 @@ public:
inline double getDiameter() const { return diameter; };
inline double getHeight() const { return height; };
virtual const char* getTypeString(void) const { return "thunderstorm"; }
const char* getTypeString(void) const override { return "thunderstorm"; }
private:
double diameter; // diameter of turbulence zone, in nm
double height; // top of turbulence zone, in feet MSL
double strength_norm; // strength of turbulence
void Run(double dt);
void Run(double dt);
// lightning stuff
double delay; // average time (sec) between lightning flashes
@ -71,6 +70,4 @@ private:
};
#endif // _FG_AIStorm_HXX

View file

@ -39,10 +39,10 @@ public:
FGAITanker(FGAISchedule* ref = 0);
~FGAITanker();
virtual void readFromScenario(SGPropertyNode* scFileNode);
virtual void bind();
void readFromScenario(SGPropertyNode* scFileNode) override;
void bind() override;
virtual const char* getTypeString(void) const { return "tanker"; }
const char* getTypeString(void) const override { return "tanker"; }
void setTACANChannelID(const std::string& id);
@ -51,7 +51,7 @@ private:
bool contact; // set if this tanker is within fuelling range
virtual void Run(double dt);
virtual void update (double dt);
void update(double dt) override;
};
#endif

View file

@ -36,11 +36,11 @@ public:
FGAIThermal();
~FGAIThermal();
void readFromScenario(SGPropertyNode* scFileNode);
void readFromScenario(SGPropertyNode* scFileNode) override;
bool init(ModelSearchOrder searchOrder) override;
virtual void bind();
virtual void update(double dt);
void bind() override;
void update(double dt) override;
inline void setMaxStrength( double s ) { max_strength = s; };
inline void setDiameter( double d ) { diameter = d; };
@ -56,7 +56,7 @@ public:
inline double getV_up_min() const { return v_up_min; };
inline double getR_up_frac() const { return r_up_frac; };
virtual const char* getTypeString(void) const { return "thermal"; }
const char* getTypeString(void) const override { return "thermal"; }
void getGroundElev(double dt);
private:

View file

@ -33,14 +33,14 @@ public:
FGAIWingman();
virtual ~FGAIWingman();
virtual void readFromScenario(SGPropertyNode* scFileNode);
void readFromScenario(SGPropertyNode* scFileNode) override;
bool init(ModelSearchOrder searchOrder) override;
virtual void bind();
virtual void reinit();
virtual void update (double dt);
void bind() override;
void reinit() override;
void update(double dt) override;
virtual const char* getTypeString(void) const { return "wingman"; }
const char* getTypeString(void) const override { return "wingman"; }
private:
void formateToAC(double dt);