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

View file

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