1
0
Fork 0

Maintenance: AIBaseAircraft

SPDX tags.
explicit ctor.
This commit is contained in:
scttgs0 2023-05-21 16:47:36 -05:00
parent 1ab1471d5a
commit b09def6713
2 changed files with 74 additions and 97 deletions

View file

@ -1,39 +1,30 @@
// FGAIBaseAircraft - abstract base class for AI aircraft
// Written by Stuart Buchanan, started August 2002
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
/*
* SPDX-FileName: AIBaseAircraft.cxx
* SPDX-FileComment: abstract base class for AI aircraft
* SPDX-FileCopyrightText: Written by Stuart Buchanan, started August 2002
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "AIBaseAircraft.hxx"
#include <Main/globals.hxx>
FGAIBaseAircraft::FGAIBaseAircraft(object_type ot) :
FGAIBase(ot, false),
m_gearPos(0.0),
m_flapsPos(0.0),
m_spoilerPos(0.0),
m_speedbrakePos(0.0),
m_beaconLight(false),
m_cabinLight(false),
m_landingLight(false),
m_navLight(false),
m_strobeLight(false),
m_taxiLight(false)
{}
FGAIBaseAircraft::FGAIBaseAircraft(object_type ot) : FGAIBase(ot, false),
m_gearPos(0.0),
m_flapsPos(0.0),
m_spoilerPos(0.0),
m_speedbrakePos(0.0),
m_beaconLight(false),
m_cabinLight(false),
m_landingLight(false),
m_navLight(false),
m_strobeLight(false),
m_taxiLight(false)
{
}
void FGAIBaseAircraft::bind() {
void FGAIBaseAircraft::bind()
{
FGAIBase::bind();
// All gear positions are linked for simplicity
@ -45,48 +36,47 @@ void FGAIBaseAircraft::bind() {
tie("gear/gear[5]/position-norm", SGRawValuePointer<double>(&m_gearPos));
tie("surface-positions/flap-pos-norm",
SGRawValueMethods<FGAIBaseAircraft,double>(*this,
&FGAIBaseAircraft::FlapsPos,
&FGAIBaseAircraft::FlapsPos));
SGRawValueMethods<FGAIBaseAircraft, double>(*this,
&FGAIBaseAircraft::FlapsPos,
&FGAIBaseAircraft::FlapsPos));
tie("surface-positions/spoiler-pos-norm",
SGRawValueMethods<FGAIBaseAircraft,double>(*this,
&FGAIBaseAircraft::SpoilerPos,
&FGAIBaseAircraft::SpoilerPos));
SGRawValueMethods<FGAIBaseAircraft, double>(*this,
&FGAIBaseAircraft::SpoilerPos,
&FGAIBaseAircraft::SpoilerPos));
tie("surface-positions/speedbrake-pos-norm",
SGRawValueMethods<FGAIBaseAircraft,double>(*this,
&FGAIBaseAircraft::SpeedBrakePos,
&FGAIBaseAircraft::SpeedBrakePos));
SGRawValueMethods<FGAIBaseAircraft, double>(*this,
&FGAIBaseAircraft::SpeedBrakePos,
&FGAIBaseAircraft::SpeedBrakePos));
tie("controls/lighting/beacon",
SGRawValueMethods<FGAIBaseAircraft,bool>(*this,
&FGAIBaseAircraft::BeaconLight,
&FGAIBaseAircraft::BeaconLight));
SGRawValueMethods<FGAIBaseAircraft, bool>(*this,
&FGAIBaseAircraft::BeaconLight,
&FGAIBaseAircraft::BeaconLight));
tie("controls/lighting/cabin-lights",
SGRawValueMethods<FGAIBaseAircraft,bool>(*this,
&FGAIBaseAircraft::CabinLight,
&FGAIBaseAircraft::CabinLight));
SGRawValueMethods<FGAIBaseAircraft, bool>(*this,
&FGAIBaseAircraft::CabinLight,
&FGAIBaseAircraft::CabinLight));
tie("controls/lighting/landing-lights",
SGRawValueMethods<FGAIBaseAircraft,bool>(*this,
&FGAIBaseAircraft::LandingLight,
&FGAIBaseAircraft::LandingLight));
SGRawValueMethods<FGAIBaseAircraft, bool>(*this,
&FGAIBaseAircraft::LandingLight,
&FGAIBaseAircraft::LandingLight));
tie("controls/lighting/nav-lights",
SGRawValueMethods<FGAIBaseAircraft,bool>(*this,
&FGAIBaseAircraft::NavLight,
&FGAIBaseAircraft::NavLight));
SGRawValueMethods<FGAIBaseAircraft, bool>(*this,
&FGAIBaseAircraft::NavLight,
&FGAIBaseAircraft::NavLight));
tie("controls/lighting/strobe",
SGRawValueMethods<FGAIBaseAircraft,bool>(*this,
&FGAIBaseAircraft::StrobeLight,
&FGAIBaseAircraft::StrobeLight));
SGRawValueMethods<FGAIBaseAircraft, bool>(*this,
&FGAIBaseAircraft::StrobeLight,
&FGAIBaseAircraft::StrobeLight));
tie("controls/lighting/taxi-lights",
SGRawValueMethods<FGAIBaseAircraft,bool>(*this,
&FGAIBaseAircraft::TaxiLight,
&FGAIBaseAircraft::TaxiLight));
SGRawValueMethods<FGAIBaseAircraft, bool>(*this,
&FGAIBaseAircraft::TaxiLight,
&FGAIBaseAircraft::TaxiLight));
}

View file

@ -1,19 +1,9 @@
// FGAIBaseAircraft - abstract base class for AI aircraft
// Written by Stuart Buchanan, started August 2002
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
/*
* SPDX-FileName: AIBaseAircraft.hxx
* SPDX-FileComment: abstract base class for AI aircraft
* SPDX-FileCopyrightText: Written by Stuart Buchanan, started August 2002
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
@ -22,38 +12,36 @@
class FGAIBaseAircraft : public FGAIBase
{
public:
FGAIBaseAircraft(object_type otype = object_type::otAircraft);
explicit FGAIBaseAircraft(object_type otype = object_type::otAircraft);
void bind() override;
// Note that this is mapped to all 6 gear indices gear/gear[0..5]
void GearPos(double pos) { m_gearPos = pos; };
void FlapsPos(double pos) { m_flapsPos = pos; };
void SpoilerPos(double pos) { m_spoilerPos = pos; };
void GearPos(double pos) { m_gearPos = pos; };
void FlapsPos(double pos) { m_flapsPos = pos; };
void SpoilerPos(double pos) { m_spoilerPos = pos; };
void SpeedBrakePos(double pos) { m_speedbrakePos = pos; };
void BeaconLight(bool light) { m_beaconLight = light; };
void LandingLight(bool light) { m_landingLight = light; };
void NavLight(bool light) { m_navLight = light; };
void StrobeLight(bool light) { m_strobeLight = light; };
void TaxiLight(bool light) { m_taxiLight = light; };
void CabinLight(bool light) { m_cabinLight = light; };
void BeaconLight(bool light) { m_beaconLight = light; };
void LandingLight(bool light) { m_landingLight = light; };
void NavLight(bool light) { m_navLight = light; };
void StrobeLight(bool light) { m_strobeLight = light; };
void TaxiLight(bool light) { m_taxiLight = light; };
void CabinLight(bool light) { m_cabinLight = light; };
double GearPos() const { return m_gearPos; };
double FlapsPos() const { return m_flapsPos; };
double SpoilerPos() const { return m_spoilerPos; };
double GearPos() const { return m_gearPos; };
double FlapsPos() const { return m_flapsPos; };
double SpoilerPos() const { return m_spoilerPos; };
double SpeedBrakePos() const { return m_speedbrakePos; };
bool BeaconLight() const { return m_beaconLight; };
bool LandingLight() const { return m_landingLight; };
bool NavLight() const { return m_navLight; };
bool StrobeLight() const { return m_strobeLight; };
bool TaxiLight() const { return m_taxiLight; };
bool CabinLight() const { return m_cabinLight; };
bool BeaconLight() const { return m_beaconLight; };
bool LandingLight() const { return m_landingLight; };
bool NavLight() const { return m_navLight; };
bool StrobeLight() const { return m_strobeLight; };
bool TaxiLight() const { return m_taxiLight; };
bool CabinLight() const { return m_cabinLight; };
protected:
// Aircraft properties.
// Aircraft properties.
double m_gearPos;
double m_flapsPos;
double m_spoilerPos;
@ -67,4 +55,3 @@ protected:
bool m_strobeLight;
bool m_taxiLight;
};