1
0
Fork 0

AITanker: Maintenance

virtual dtor
ensure all members are initialized
config.h is unused
This commit is contained in:
Scott Giese 2022-01-15 15:20:21 -06:00
parent 6bd7415d94
commit 75941319d2
2 changed files with 7 additions and 24 deletions

View file

@ -19,10 +19,6 @@
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include "AITanker.hxx" #include "AITanker.hxx"
using std::string; using std::string;
@ -30,8 +26,6 @@ using std::string;
FGAITanker::FGAITanker(FGAISchedule* ref): FGAIAircraft(ref){ FGAITanker::FGAITanker(FGAISchedule* ref): FGAIAircraft(ref){
} }
FGAITanker::~FGAITanker() {}
void FGAITanker::readFromScenario(SGPropertyNode* scFileNode) { void FGAITanker::readFromScenario(SGPropertyNode* scFileNode) {
if (!scFileNode) if (!scFileNode)
return; return;
@ -39,7 +33,6 @@ void FGAITanker::readFromScenario(SGPropertyNode* scFileNode) {
FGAIAircraft::readFromScenario(scFileNode); FGAIAircraft::readFromScenario(scFileNode);
setTACANChannelID(scFileNode->getStringValue("TACAN-channel-ID","")); setTACANChannelID(scFileNode->getStringValue("TACAN-channel-ID",""));
setName(scFileNode->getStringValue("name", "Tanker")); setName(scFileNode->getStringValue("name", "Tanker"));
} }
void FGAITanker::bind() { void FGAITanker::bind() {
@ -58,9 +51,7 @@ void FGAITanker::setTACANChannelID(const string& id) {
} }
void FGAITanker::Run(double dt) { void FGAITanker::Run(double dt) {
//FGAIAircraft::Run(dt); double start = pos.getElevationFt() + 1000.0;
double start = pos.getElevationFt() + 1000;
altitude_agl_ft = _getAltitudeAGL(pos, start); altitude_agl_ft = _getAltitudeAGL(pos, start);
//###########################// //###########################//
@ -69,17 +60,13 @@ void FGAITanker::Run(double dt) {
double range_ft2 = UpdateRadar(manager); double range_ft2 = UpdateRadar(manager);
// check if radar contact // check if radar contact
if ( (range_ft2 < 250.0 * 250.0) && (y_shift > 0.0) if ( (range_ft2 < 250.0 * 250.0) && (y_shift > 0.0) && (elevation > 0.0) ) {
&& (elevation > 0.0) ) {
//refuel_node->setBoolValue(true);
contact = true; contact = true;
} else { } else {
//refuel_node->setBoolValue(false);
contact = false; contact = false;
} }
} }
void FGAITanker::update(double dt) { void FGAITanker::update(double dt) {
FGAIAircraft::update(dt); FGAIAircraft::update(dt);
Run(dt); Run(dt);

View file

@ -19,8 +19,7 @@
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef FGAITANKER_HXX #pragma once
#define FGAITANKER_HXX
#include "AIAircraft.hxx" #include "AIAircraft.hxx"
@ -37,21 +36,18 @@
class FGAITanker : public FGAIAircraft { class FGAITanker : public FGAIAircraft {
public: public:
FGAITanker(FGAISchedule* ref = 0); FGAITanker(FGAISchedule* ref = 0);
~FGAITanker(); virtual ~FGAITanker() = default;
void readFromScenario(SGPropertyNode* scFileNode) override;
void bind() override;
const char* getTypeString(void) const override { return "tanker"; } const char* getTypeString(void) const override { return "tanker"; }
void readFromScenario(SGPropertyNode* scFileNode) override;
void bind() override;
void setTACANChannelID(const std::string& id); void setTACANChannelID(const std::string& id);
private: private:
std::string TACAN_channel_id; // The TACAN channel of this tanker std::string TACAN_channel_id; // The TACAN channel of this tanker
bool contact; // set if this tanker is within fuelling range bool contact = false; // set if this tanker is within fuelling range
virtual void Run(double dt); virtual void Run(double dt);
void update(double dt) override; void update(double dt) override;
}; };
#endif