1
0
Fork 0

Maintenance: namespace

Clean up namespaces.
Don't use broad 'using namespace' context in header files.
Header Guards.
SPDX tags.
This commit is contained in:
scttgs0 2023-05-20 17:10:29 -05:00
parent cd35776536
commit 89043efdaa
19 changed files with 688 additions and 885 deletions

View file

@ -1,22 +1,9 @@
// FGAIAircraft - FGAIBase-derived class creates an AI airplane
//
// Written by David Culp, started October 2003.
//
// Copyright (C) 2003 David P. Culp - davidculp2@comcast.net
//
// 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: AIAircraft.cxx
* SPDX-FileComment: AIBase derived class creates an AI aircraft
* SPDX-FileCopyrightText: Copyright (C) 2003 David P. Culp - davidculp2@comcast.net
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include <Main/fg_props.hxx>
#include <Main/globals.hxx>
@ -1485,7 +1472,7 @@ void FGAIAircraft::updateUserFlightPlan(double dt)
<< "\t" << current->getPos().getLatitudeDeg()
<< "\t" << current->getPos().getLongitudeDeg());
if ( currDist>legDistance ) {
// We are definetly beyond the airport
// We are definitely beyond the airport
fp->incrementLeg();
}
}
@ -1758,7 +1745,7 @@ void FGAIAircraft::dumpCSV(std::unique_ptr<sg_ofstream> &o, int lineIndex) {
const double headingDiff = SGMiscd::normalizePeriodic(-180, 180, hdg-tgt_heading);
(*o) << lineIndex << "\t";
(*o) << setprecision(12);
(*o) << std::setprecision(12);
(*o) << this->getGeodPos().getLatitudeDeg() << "\t";
(*o) << this->getGeodPos().getLongitudeDeg() << "\t";
(*o) << this->getGeodPos().getElevationFt() << "\t";

View file

@ -1,31 +1,19 @@
// FGAIAircraft - AIBase derived class creates an AI aircraft
//
// Written by David Culp, started October 2003.
//
// Copyright (C) 2003 David P. Culp - davidculp2@comcast.net
//
// 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: AIAircraft.hxx
* SPDX-FileComment: AIBase derived class creates an AI aircraft
* SPDX-FileCopyrightText: Copyright (C) 2003 David P. Culp - davidculp2@comcast.net
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include <iostream>
#include <string>
#include <string_view>
#include <iostream>
#include "AIBaseAircraft.hxx"
class PerformanceData;
class FGAISchedule;
class FGAIFlightPlan;
@ -34,10 +22,8 @@ class FGATCInstruction;
class FGAIWaypoint;
class sg_ofstream;
namespace AILeg
{
enum Type
{
namespace AILeg {
enum Type {
STARTUP_PUSHBACK = 1,
TAXI = 2,
TAKEOFF = 3,
@ -52,23 +38,21 @@ namespace AILeg
}
// 1 = joined departure queue; 2 = Passed DepartureHold waypoint; handover control to tower; 0 = any other state.
namespace AITakeOffStatus
{
enum Type
{
namespace AITakeOffStatus {
enum Type {
NONE = 0,
QUEUED = 1, // joined departure queue
CLEARED_FOR_TAKEOFF = 2 // Passed DepartureHold waypoint; handover control to tower;
};
}
class FGAIAircraft : public FGAIBaseAircraft {
class FGAIAircraft : public FGAIBaseAircraft
{
public:
FGAIAircraft(FGAISchedule* ref = 0);
virtual ~FGAIAircraft();
string_view getTypeString(void) const override { return "aircraft"; }
std::string_view getTypeString(void) const override { return "aircraft"; }
void readFromScenario(SGPropertyNode* scFileNode) override;
void bind() override;
@ -83,7 +67,10 @@ public:
void initializeFlightPlan();
#endif
FGAIFlightPlan* GetFlightPlan() const { return fp.get(); };
FGAIFlightPlan* GetFlightPlan() const
{
return fp.get();
};
void ProcessFlightPlan(double dt, time_t now);
time_t checkForArrivalTime(const std::string& wptName);
time_t calcDeparture();
@ -150,6 +137,7 @@ public:
bool isBlockedBy(FGAIAircraft* other);
void dumpCSVHeader(std::unique_ptr<sg_ofstream>& o);
void dumpCSV(std::unique_ptr<sg_ofstream>& o, int lineIndex);
protected:
void Run(double dt);
@ -205,11 +193,13 @@ private:
int determineNextLeg(int leg);
void handleATCRequests(double dt);
inline bool isStationary() {
inline bool isStationary()
{
return ((fabs(speed) <= 0.0001) && (fabs(tgt_speed) <= 0.0001));
}
inline bool needGroundElevation() {
inline bool needGroundElevation()
{
if (!isStationary())
_needsGroundElevation = true;
return _needsGroundElevation;

View file

@ -1,23 +1,10 @@
// FGAIBallistic.hxx - AIBase derived class creates an AI ballistic object
//
// Written by David Culp, started November 2003.
// - davidculp2@comcast.net
//
// With major additions by Vivian Meazza, Feb 2008
//
// 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: AIBallistic.hxx
* SPDX-FileComment: AIBase derived class creates an AI ballistic object
* SPDX-FileCopyrightText: Copyright (C) 2003 David P. Culp - davidculp2@comcast.net
* SPDX-FileContributor: With major additions by Vivian Meazza, Feb 2008
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
@ -25,20 +12,20 @@
#include <string_view>
#include <vector>
#include <simgear/structure/SGSharedPtr.hxx>
#include <simgear/scene/material/mat.hxx>
#include <simgear/structure/SGSharedPtr.hxx>
#include "AIManager.hxx"
#include "AIBase.hxx"
#include "AIManager.hxx"
class FGAIBallistic : public FGAIBase {
class FGAIBallistic : public FGAIBase
{
public:
FGAIBallistic(object_type ot = object_type::otBallistic);
virtual ~FGAIBallistic() = default;
string_view getTypeString(void) const override { return "ballistic"; }
std::string_view getTypeString(void) const override { return "ballistic"; }
void readFromScenario(SGPropertyNode* scFileNode) override;
bool init(ModelSearchOrder searchOrder) override;
@ -148,7 +135,6 @@ public:
double hs;
void setTgtXOffset(double x);
void setTgtYOffset(double y);
void setTgtZOffset(double z);
@ -169,7 +155,6 @@ public:
SGGeod _oldoffsetpos;
private:
double _az_random_error; // maximum azimuth error in degrees
double _el_random_error; // maximum elevation error in degrees
bool _aero_stabilised; // if true, object will align with trajectory
@ -183,7 +168,7 @@ private:
double _mass; // slugs
bool _random; // modifier for Cd, life, az
double _life_randomness; // dimension for _random, only applies to life at present
double _load_resistance; // ground load resistanc N/m^2
double _load_resistance; // ground load resistance N/m^2
double _frictionFactor = 0.0; // dimensionless modifier for Coefficient of Friction
bool _solid; // if true ground is solid for FDMs
// double _elevation_m = 0.0; // ground elevation in meters

View file

@ -1,24 +1,10 @@
// FGAIBase - abstract base class for AI objects
// Written by David Culp, started Nov 2003, based on
// David Luff's FGAIEntity class.
// - davidculp2@comcast.net
//
// With additions by Mathias Froehlich & Vivian Meazza 2004 -2007
//
// 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: AIBase.cxx
* SPDX-FileComment: abstract base class for AI objects, based on David Luff's FGAIEntity class.
* SPDX-FileCopyrightText: Written by David Culp, started Nov 2003 - davidculp2@comcast.net
* SPDX-FileContributor: With additions by Mathias Froehlich & Vivian Meazza 2004-2007
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include <config.h>
@ -470,11 +456,11 @@ void FGAIBase::updateLOD()
_model->setRange(modelLowDetailIndex , maxRangeBare, maxRangeDetail); // least detailed
} else if (_low_res.valid() && !_high_res.valid()) {
// we have only low_res_model model it obviously will have to be displayed from the smallest value
_model->setRange(modelLowDetailIndex, min(maxRangeBare, maxRangeDetail), FLT_MAX );
_model->setRange(modelLowDetailIndex, std::min(maxRangeBare, maxRangeDetail), FLT_MAX );
_model->setRange(modelHighDetailIndex, 0,0);
} else if (!_low_res.valid() && _high_res.valid()) {
// we have only high_res model it obviously will have to be displayed from the smallest value
_model->setRange(modelHighDetailIndex, min(maxRangeBare, maxRangeDetail), FLT_MAX );
_model->setRange(modelHighDetailIndex, std::min(maxRangeBare, maxRangeDetail), FLT_MAX );
_model->setRange(modelLowDetailIndex, 0,0);
}
} else {
@ -654,7 +640,7 @@ bool FGAIBase::init(ModelSearchOrder searchOrder)
// Load models
_model = new osg::LOD();
vector<string> model_list = resolveModelPath(searchOrder);
std::vector<string> model_list = resolveModelPath(searchOrder);
if(model_list.size() == 1 && _modeldata && _modeldata->hasInteriorPath()) {
// Only one model and interior available (expecting this to be a high_res model)
_low_res = new osg::PagedLOD(); // Dummy node to keep LOD node happy

View file

@ -1,21 +1,9 @@
// FGAIBase.hxx - abstract base class for AI objects
// Written by David Culp, started Nov 2003, based on
// David Luff's FGAIEntity class.
// - davidculp2@comcast.net
//
// 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: AIBase.hxx
* SPDX-FileComment: abstract base class for AI objects, based on David Luff's FGAIEntity class.
* SPDX-FileCopyrightText: Written by David Culp, started Nov 2003 - davidculp2@comcast.net
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
@ -33,8 +21,13 @@
#include <simgear/structure/SGReferenced.hxx>
#include <simgear/structure/SGSharedPtr.hxx>
namespace osg { class PagedLOD; }
namespace simgear { class BVHMaterial; }
namespace osg {
class PagedLOD;
}
namespace simgear {
class BVHMaterial;
}
class FGAIManager;
class FGAIFlightPlan;
@ -308,7 +301,6 @@ private:
osg::ref_ptr<osg::PagedLOD> _high_res;
osg::ref_ptr<osg::Group> _group;
osg::ref_ptr<osg::PagedLOD> _interior;
osg::ref_ptr<FGAIModelData> _modeldata;
SGSharedPtr<FGFX> _fx;
@ -318,7 +310,7 @@ private:
public:
object_type getType();
virtual string_view getTypeString(void) const { return "null"; }
virtual std::string_view getTypeString(void) const { return "null"; }
bool isa(object_type otype);
@ -390,110 +382,136 @@ public:
typedef SGSharedPtr<FGAIBase> FGAIBasePtr;
inline void FGAIBase::setManager(FGAIManager* mgr, SGPropertyNode* p) {
inline void FGAIBase::setManager(FGAIManager* mgr, SGPropertyNode* p)
{
manager = mgr;
props = p;
}
inline void FGAIBase::setPath(const char* model ) {
inline void FGAIBase::setPath(const char* model)
{
model_path.append(model);
}
inline void FGAIBase::setPathLowres(std::string model ) {
inline void FGAIBase::setPathLowres(std::string model)
{
model_path_lowres.append(model);
}
inline void FGAIBase::setFallbackModelIndex(const int i ) {
inline void FGAIBase::setFallbackModelIndex(const int i)
{
_fallback_model_index = i;
}
inline void FGAIBase::setSMPath(const std::string& p) {
inline void FGAIBase::setSMPath(const std::string& p)
{
_path = p;
}
inline void FGAIBase::setServiceable(bool s) {
inline void FGAIBase::setServiceable(bool s)
{
serviceable = s;
}
inline void FGAIBase::setSpeed( double speed_KTAS ) {
inline void FGAIBase::setSpeed(double speed_KTAS)
{
speed = tgt_speed = speed_KTAS;
}
inline void FGAIBase::setRadius( double radius ) {
inline void FGAIBase::setRadius(double radius)
{
turn_radius_ft = radius;
}
inline void FGAIBase::setHeading( double heading ) {
inline void FGAIBase::setHeading(double heading)
{
hdg = tgt_heading = heading;
}
inline void FGAIBase::setAltitude( double alt_ft ) {
inline void FGAIBase::setAltitude(double alt_ft)
{
altitude_ft = tgt_altitude_ft = alt_ft;
pos.setElevationFt(altitude_ft);
}
inline void FGAIBase::setAltitudeAGL( double alt_ft ) {
inline void FGAIBase::setAltitudeAGL(double alt_ft)
{
altitude_agl_ft = alt_ft;
}
inline void FGAIBase::setBank( double bank ) {
inline void FGAIBase::setBank(double bank)
{
roll = tgt_roll = bank;
no_roll = false;
}
inline void FGAIBase::setPitch( double newpitch ) {
inline void FGAIBase::setPitch(double newpitch)
{
pitch = tgt_pitch = newpitch;
}
inline void FGAIBase::setLongitude( double longitude ) {
inline void FGAIBase::setLongitude(double longitude)
{
pos.setLongitudeDeg(longitude);
}
inline void FGAIBase::setLatitude ( double latitude ) {
inline void FGAIBase::setLatitude(double latitude)
{
pos.setLatitudeDeg(latitude);
}
inline void FGAIBase::setCallSign(const std::string& s) {
inline void FGAIBase::setCallSign(const std::string& s)
{
_callsign = s;
}
inline void FGAIBase::setXoffset(double x) {
inline void FGAIBase::setXoffset(double x)
{
_x_offset = x;
}
inline void FGAIBase::setYoffset(double y) {
inline void FGAIBase::setYoffset(double y)
{
_y_offset = y;
}
inline void FGAIBase::setZoffset(double z) {
inline void FGAIBase::setZoffset(double z)
{
_z_offset = z;
}
inline void FGAIBase::setPitchoffset(double p) {
inline void FGAIBase::setPitchoffset(double p)
{
_pitch_offset = p;
}
inline void FGAIBase::setRolloffset(double r) {
inline void FGAIBase::setRolloffset(double r)
{
_roll_offset = r;
}
inline void FGAIBase::setYawoffset(double y) {
inline void FGAIBase::setYawoffset(double y)
{
_yaw_offset = y;
}
inline void FGAIBase::setParentName(const std::string& p) {
inline void FGAIBase::setParentName(const std::string& p)
{
_parent = p;
}
inline void FGAIBase::setName(const std::string& n) {
inline void FGAIBase::setName(const std::string& n)
{
_name = n;
}
inline void FGAIBase::setCollisionLength(int length){
inline void FGAIBase::setCollisionLength(int length)
{
collisionLength = length;
}
inline void FGAIBase::setCollisionHeight(int height){
inline void FGAIBase::setCollisionHeight(int height)
{
collisionHeight = height;
}
@ -512,25 +530,29 @@ inline void FGAIBase::calcRangeBearing(double lat, double lon, double lat2, doub
range = distance * SG_METER_TO_NM;
}
inline double FGAIBase::calcRelBearingDeg(double bearing, double heading){
inline double FGAIBase::calcRelBearingDeg(double bearing, double heading)
{
double angle = bearing - heading;
SG_NORMALIZE_RANGE(angle, -180.0, 180.0);
return angle;
}
inline double FGAIBase::calcTrueBearingDeg(double bearing, double heading){
inline double FGAIBase::calcTrueBearingDeg(double bearing, double heading)
{
double angle = bearing + heading;
SG_NORMALIZE_RANGE(angle, 0.0, 360.0);
return angle;
}
inline double FGAIBase::calcRecipBearingDeg(double bearing){
inline double FGAIBase::calcRecipBearingDeg(double bearing)
{
double angle = bearing - 180;
SG_NORMALIZE_RANGE(angle, 0.0, 360.0);
return angle;
}
inline void FGAIBase::setMaxSpeed(double m) {
inline void FGAIBase::setMaxSpeed(double m)
{
_max_speed = m;
}
@ -539,7 +561,7 @@ inline void FGAIBase::setMaxSpeed(double m) {
* The difference in height is used first and then the range must be within
* the value specifed in the length field. This effective chops the top and
* bottom off the circle - but does not take into account the orientation of the
* AI model; so this algorithm is fast but fairly innaccurate.
* AI model; so this algorithm is fast but fairly inaccurate.
*
* Default values:
* +---------------+-------------+------------+
@ -577,4 +599,3 @@ inline int FGAIBase::getCollisionLength() const
return collisionLength;
}

View file

@ -1,21 +1,9 @@
// FGAICarrier - FGAIShip-derived class creates an AI aircraft carrier
//
// Written by David Culp, started October 2004.
// - davidculp2@comcast.net
//
// 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: AICarrier.cxx
* SPDX-FileComment: AIShip-derived class creates an AI aircraft carrier
* SPDX-FileCopyrightText: Written by David Culp, started October 2004 - davidculp2@comcast.net
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include <config.h>
@ -99,7 +87,7 @@ void FGAICarrier::readFromScenario(SGPropertyNode* scFileNode) {
std::vector<SGPropertyNode_ptr> props = scFileNode->getChildren("parking-pos");
std::vector<SGPropertyNode_ptr>::const_iterator it;
for (it = props.begin(); it != props.end(); ++it) {
const string name = (*it)->getStringValue("name", "unnamed");
const std::string name = (*it)->getStringValue("name", "unnamed");
// Transform to the right coordinate frame, configuration is done in
// the usual x-back, y-right, z-up coordinates, computations
// in the simulation usual body x-forward, y-right, z-down coordinates
@ -141,11 +129,11 @@ void FGAICarrier::setDeckAltitudeFt(const double altitude_feet) {
_deck_altitude_ft = altitude_feet;
}
void FGAICarrier::setSign(const string& s) {
void FGAICarrier::setSign(const std::string& s) {
_sign = s;
}
void FGAICarrier::setTACANChannelID(const string& id) {
void FGAICarrier::setTACANChannelID(const std::string& id) {
_TACAN_channel_id = id;
}
@ -474,7 +462,7 @@ void FGAICarrier::bind(){
}
}
bool FGAICarrier::getParkPosition(const string& id, SGGeod& geodPos,
bool FGAICarrier::getParkPosition(const std::string& id, SGGeod& geodPos,
double& hdng, SGVec3d& uvw)
{
@ -724,7 +712,7 @@ void FGAICarrier::UpdateElevator(double dt) {
void FGAICarrier::UpdateJBD(double dt) {
const string launchbar_state = _launchbar_state_node->getStringValue();
const std::string launchbar_state = _launchbar_state_node->getStringValue();
double step = 0;
if (launchbar_state == "Engaged"){

View file

@ -1,22 +1,9 @@
// FGAICarrier - AIShip-derived class creates an AI aircraft carrier
//
// Written by David Culp, started October 2004.
//
// Copyright (C) 2004 David P. Culp - davidculp2@comcast.net
//
// 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: AICarrier.hxx
* SPDX-FileComment: AIShip-derived class creates an AI aircraft carrier
* SPDX-FileCopyrightText: Copyright (C) 2004 David P. Culp - davidculp2@comcast.net
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
@ -28,10 +15,10 @@
#include <simgear/emesary/Emesary.hxx>
#include "AIShip.hxx"
#include "AIBase.hxx"
#include "AIManager.hxx"
class FGAIManager;
class FGAICarrier;
@ -41,7 +28,7 @@ public:
FGAICarrier();
virtual ~FGAICarrier();
string_view getTypeString(void) const override { return "carrier"; }
std::string_view getTypeString(void) const override { return "carrier"; }
void readFromScenario(SGPropertyNode* scFileNode) override;
void setSign(const std::string&);

View file

@ -1,22 +1,8 @@
// FGAIGroundVehicle - FGAIShip-derived class creates an AI Ground Vehicle
// by adding a ground following utility
//
// Written by Vivian Meazza, started August 2009.
// - vivian.meazza at lineone.net
//
// 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: AIEscort.hxx
* SPDX-FileCopyrightText: Written by Vivian Meazza, started August 2009 - vivian.meazza at lineone.net
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
@ -33,13 +19,14 @@
#include "AIBase.hxx"
#include "AIManager.hxx"
class FGAIEscort : public FGAIShip
{
public:
FGAIEscort();
virtual ~FGAIEscort() = default;
string_view getTypeString(void) const override { return "escort"; }
std::string_view getTypeString(void) const override { return "escort"; }
void readFromScenario(SGPropertyNode* scFileNode) override;
bool init(ModelSearchOrder searchOrder) override;

View file

@ -1,20 +1,9 @@
// // FGAIFlightPlan - class for loading and storing AI flight plans
// Written by David Culp, started May 2004
// - davidculp2@comcast.net
//
// 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: AIFlightPlan.cxx
* SPDX-FileComment: class for loading and storing AI flight plans
* SPDX-FileCopyrightText: Written by David Culp, started May 2004 - davidculp2@comcast.net
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
@ -575,11 +564,11 @@ void FGAIFlightPlan::pushBackWaypoint(FGAIWaypoint *wpt)
SG_LOG(SG_AI, SG_DEBUG, "Double WP : \t" << wpt->getName() << " not added ");
} else {
waypoints.push_back(wpt);
SG_LOG(SG_AI, SG_BULK, "Added WP : \t" << setprecision(12) << wpt->getName() << "\t" << wpt->getPos() << "\t" << wpt->getSpeed());
SG_LOG(SG_AI, SG_BULK, "Added WP : \t" << std::setprecision(12) << wpt->getName() << "\t" << wpt->getPos() << "\t" << wpt->getSpeed());
}
} else {
waypoints.push_back(wpt);
SG_LOG(SG_AI, SG_BULK, "Added WP : \t" << setprecision(12) << wpt->getName() << "\t" << wpt->getPos() << "\t" << wpt->getSpeed());
SG_LOG(SG_AI, SG_BULK, "Added WP : \t" << std::setprecision(12) << wpt->getName() << "\t" << wpt->getPos() << "\t" << wpt->getSpeed());
}
// std::vector::push_back invalidates waypoints
// so we should restore wpt_iterator after push_back

View file

@ -1,22 +1,9 @@
// FGAIGroundVehicle - FGAIShip-derived class creates an AI Ground Vehicle
// by adding a ground following utility
//
// Written by Vivian Meazza, started August 2009.
// - vivian.meazza at lineone.net
//
// 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: AIGroundVehicle.hxx
* SPDX-FileComment: AIShip-derived class creates an AI Ground Vehicle by adding a ground following utility
* SPDX-FileCopyrightText: Written by Vivian Meazza, started August 2009 - vivian.meazza at lineone.net
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
@ -24,20 +11,22 @@
#include <string_view>
#include <vector>
#include <simgear/structure/SGSharedPtr.hxx>
#include <simgear/scene/material/mat.hxx>
#include <simgear/structure/SGSharedPtr.hxx>
#include "AIShip.hxx"
#include "AIManager.hxx"
#include "AIBase.hxx"
#include "AIManager.hxx"
class FGAIGroundVehicle : public FGAIShip {
class FGAIGroundVehicle : public FGAIShip
{
public:
FGAIGroundVehicle();
virtual ~FGAIGroundVehicle() = default;
string_view getTypeString(void) const override { return "groundvehicle"; }
std::string_view getTypeString(void) const override { return "groundvehicle"; }
void readFromScenario(SGPropertyNode* scFileNode) override;
bool init(ModelSearchOrder searchOrder) override;
@ -77,7 +66,7 @@ private:
SGGeod _selectedpos;
bool _solid = true; // if true ground is solid for FDMs
double _load_resistance = 0.0; // ground load resistanc N/m^2
double _load_resistance = 0.0; // ground load resistance N/m^2
double _frictionFactor = 0.0; // dimensionless modifier for Coefficient of Friction
double _elevation = 0.0;

View file

@ -1,22 +1,9 @@
// AIManager.cxx Based on David Luff's AIMgr:
// - a global management type for AI objects
//
// Written by David Culp, started October 2003.
// - davidculp2@comcast.net
//
// 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: AIManager.cxx
* SPDX-FileComment: a global management type for AI objects, based on David Luff's AIMgr
* SPDX-FileCopyrightText: Written by David Culp, started October 2003 - davidculp2@comcast.net
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include <algorithm>
#include <cstring>
@ -263,7 +250,7 @@ SGPropertyNode_ptr FGAIManager::registerScenarioFile(SGPropertyNode_ptr root, co
} catch (sg_exception& e) {
SG_LOG(SG_AI, SG_WARN, "Skipping malformed scenario file:" << xmlPath);
simgear::reportFailure(simgear::LoadFailure::BadData, simgear::ErrorCode::ScenarioLoad,
string{"The scenario couldn't be loaded:"} + e.getFormattedMessage(),
std::string{"The scenario couldn't be loaded:"} + e.getFormattedMessage(),
e.getLocation());
sNode.reset();
}
@ -282,7 +269,7 @@ FGAIManager::postinit()
// process all scenarios
for (auto n : root->getChildren("scenario")) {
const string& name = n->getStringValue();
const std::string& name = n->getStringValue();
if (name.empty())
continue;
@ -425,7 +412,7 @@ FGAIManager::updateLOD(SGPropertyNode* node)
void
FGAIManager::attach(const SGSharedPtr<FGAIBase> &model)
{
string_view typeString = model->getTypeString();
std::string_view typeString = model->getTypeString();
SGPropertyNode* root = globals->get_props()->getNode("ai/models", true);
SGPropertyNode* p;
int i;
@ -619,7 +606,7 @@ FGAIBasePtr FGAIManager::getObjectFromProperty(const SGPropertyNode* aProp) cons
}
bool
FGAIManager::loadScenario( const string &id )
FGAIManager::loadScenario( const std::string &id )
{
SGPath path;
SGPropertyNode_ptr file = loadScenarioFile(id, path);
@ -643,7 +630,7 @@ FGAIManager::loadScenario( const string &id )
bool
FGAIManager::unloadScenario( const string &filename)
FGAIManager::unloadScenario( const std::string &filename)
{
auto it = _scenarios.find(filename);
if (it == _scenarios.end()) {

View file

@ -1,22 +1,9 @@
// FGAIMultiplayer - AIBase derived class creates an AI multiplayer aircraft
//
// Written by David Culp, started October 2003.
//
// Copyright (C) 2003 David P. Culp - davidculp2@comcast.net
//
// 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: AIMultiplayer.hxx
* SPDX-FileComment: AIBase derived class creates an AI multiplayer aircraft
* SPDX-FileCopyrightText: Copyright (C) 2003 David P. Culp - davidculp2@comcast.net
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
@ -28,12 +15,14 @@
#include "AIBase.hxx"
class FGAIMultiplayer : public FGAIBase {
class FGAIMultiplayer : public FGAIBase
{
public:
FGAIMultiplayer();
virtual ~FGAIMultiplayer() = default;
string_view getTypeString(void) const override { return "multiplayer"; }
std::string_view getTypeString(void) const override { return "multiplayer"; }
bool init(ModelSearchOrder searchOrder) override;
void bind() override;
void update(double dt) override;
@ -52,7 +41,6 @@ public:
void setAllowExtrapolation(bool allowExtrapolation)
{
mAllowExtrapolation = allowExtrapolation;
}
bool getAllowExtrapolation(void) const
{
@ -104,12 +92,11 @@ public:
void clearMotionInfo();
private:
// Automatic sorting of motion data according to its timestamp
typedef std::map<double, FGExternalMotionData> MotionInfo;
MotionInfo mMotionInfo;
// Map between the property id's from the multiplayers network packets
// Map between the property id's from the multiplayer network packets
// and the property nodes
typedef std::map<unsigned, SGSharedPtr<SGPropertyNode>> PropertyMap;
PropertyMap mPropertyMap;
@ -126,8 +113,7 @@ private:
double tau,
SGVec3d& ecPos,
SGQuatf& ecOrient,
SGVec3f& ecLinearVel
);
SGVec3f& ecLinearVel);
// Calculates position, orientation and velocity using extrapolation from
// *nextIt.
@ -138,8 +124,7 @@ private:
bool motion_logging,
SGVec3d& ecPos,
SGQuatf& ecOrient,
SGVec3f& ecLinearVel
);
SGVec3f& ecLinearVel);
bool mTimeOffsetSet = false;
bool realTime = false;

View file

@ -1,23 +1,10 @@
// FGAIShip - AIBase derived class creates an AI ship
//
// Written by David Culp, started November 2003.
// with major amendments and additions by Vivian Meazza, 2004 - 2007
//
// Copyright (C) 2003 David P. Culp - davidculp2@comcast.net
//
// 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: AIShip.hxx
* SPDX-FileComment: AIBase derived class creates an AI ship
* SPDX-FileCopyrightText: Copyright (C) 2003 David P. Culp - davidculp2@comcast.net
* SPDX-FileContributor: with major amendments and additions by Vivian Meazza, 2004 - 2007
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
@ -28,15 +15,16 @@
#include "AIBase.hxx"
#include "AIFlightPlan.hxx"
class FGAIManager;
class FGAIShip : public FGAIBase {
class FGAIShip : public FGAIBase
{
public:
FGAIShip(object_type ot = object_type::otShip);
virtual ~FGAIShip() = default;
string_view getTypeString(void) const override { return "ship"; }
std::string_view getTypeString(void) const override { return "ship"; }
void readFromScenario(SGPropertyNode* scFileNode) override;
bool init(ModelSearchOrder searchOrder) override;
@ -149,4 +137,3 @@ private:
bool _fp_init;
bool _missed;
};

View file

@ -1,38 +1,24 @@
// FGAIStatic - AIBase derived class creates AI static object
//
// Written by David Culp, started Jun 2005.
//
// Copyright (C) 2005 David P. Culp - davidculp2@comcast.net
//
// 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: AIStatic.hxx
* SPDX-FileComment: AIBase derived class creates AI static object
* SPDX-FileCopyrightText: Copyright (C) 2005 David P. Culp - davidculp2@comcast.net
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include <string_view>
#include "AIManager.hxx"
#include "AIBase.hxx"
#include "AIManager.hxx"
class FGAIStatic : public FGAIBase {
class FGAIStatic : public FGAIBase
{
public:
FGAIStatic();
virtual ~FGAIStatic() = default;
string_view getTypeString(void) const override { return "static"; }
std::string_view getTypeString(void) const override { return "static"; }
void update(double dt) override;
};

View file

@ -1,39 +1,26 @@
// FGAIStorm - AIBase derived class creates an AI thunderstorm
//
// Written by David Culp, started Feb 2004.
//
// Copyright (C) 2004 David P. Culp - davidculp2@comcast.net
//
// 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: AIStorm.hxx
* SPDX-FileComment: AIBase derived class creates an AI thunderstorm
* SPDX-FileCopyrightText: Copyright (C) 2004 David P. Culp - davidculp2@comcast.net
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include <string>
#include <string_view>
#include "AIManager.hxx"
#include "AIBase.hxx"
#include "AIManager.hxx"
class FGAIStorm : public FGAIBase {
class FGAIStorm : public FGAIBase
{
public:
FGAIStorm();
virtual ~FGAIStorm() = default;
string_view getTypeString(void) const override { return "thunderstorm"; }
std::string_view getTypeString(void) const override { return "thunderstorm"; }
void readFromScenario(SGPropertyNode* scFileNode) override;
void update(double dt) override;

View file

@ -1,21 +1,10 @@
// AISwiftAircraft.h - Derived AIBase class for swift aircraft
//
// Copyright (C) 2020 - swift Project Community / Contributors (http://swift-project.org/)
// Written by Lars Toenning <dev@ltoenning.de> started on April 2020.
//
// 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: AISwiftAircraft.h
* SPDX-FileComment: Derived AIBase class for swift aircraft
* SPDX-FileCopyrightText: Written by Lars Toenning <dev@ltoenning.de> started on April 2020
* SPDX-FileContributor: Copyright (C) 2020 - swift Project Community / Contributors (http://swift-project.org/)
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
@ -25,11 +14,12 @@
#include "AIBaseAircraft.hxx"
struct AircraftTransponder
{
struct AircraftTransponder {
AircraftTransponder(std::string callsign, int code, bool modeC, bool ident)
: callsign(std::move(callsign)), code(code), modeC(modeC), ident(ident)
{}
{
}
std::string callsign;
int code;
@ -37,8 +27,7 @@ struct AircraftTransponder
bool ident;
};
struct AircraftSurfaces
{
struct AircraftSurfaces {
AircraftSurfaces(std::string callsign, double gear, double flaps, double spoilers, double speedBrake, double slats, double wingSweeps,
double thrust, double elevator, double rudder, double aileron, bool landingLight, bool taxiLight, bool beaconLight,
bool strobeLight, bool navLight, int lightPattern)
@ -71,7 +60,7 @@ public:
FGAISwiftAircraft(const std::string& callsign, const std::string& modelString);
virtual ~FGAISwiftAircraft() = default;
string_view getTypeString() const override { return "swift"; }
std::string_view getTypeString() const override { return "swift"; }
void update(double dt) override;
void updatePosition(const SGGeod& position, const SGVec3d& orientation, double groundspeed, bool initPos);

View file

@ -1,23 +1,10 @@
// AITanker.hxx Based on David Culp's AIModel code
// - Tanker specific code isolated from AI Aircraft code
// by Thomas Foerster, started June 2007
//
//
// Original code written by David Culp, started October 2003.
// - davidculp2@comcast.net/
// 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: AITanker.hxx
* SPDX-FileComment: Tanker specific code isolated from AI Aircraft code, based on David Culp's AIModel code
* SPDX-FileCopyrightText: by Thomas Foerster, started June 2007
* SPDX-FileContributor: Original code written by David Culp, started October 2003 - davidculp2@comcast.net
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
@ -25,6 +12,7 @@
#include "AIAircraft.hxx"
/**
* An AI tanker for air-air refueling.
*
@ -35,12 +23,13 @@
* @author Thomas F<EFBFBD>ster <t.foerster@biologie.hu-berlin.de>
*/
class FGAITanker : public FGAIAircraft {
class FGAITanker : public FGAIAircraft
{
public:
FGAITanker(FGAISchedule* ref = 0);
virtual ~FGAITanker() = default;
string_view getTypeString(void) const override { return "tanker"; }
std::string_view getTypeString(void) const override { return "tanker"; }
void readFromScenario(SGPropertyNode* scFileNode) override;
void bind() override;

View file

@ -1,24 +1,9 @@
// FGAIThermal - FGAIBase-derived class creates an AI thermal
//
// Original by Written by David Culp
//
// An attempt to refine the thermal shape and behaviour by WooT 2009
//
// Copyright (C) 2009 Patrice Poly ( WooT )
//
// 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: AIThermal.hxx
* SPDX-FileComment: AIBase-derived class creates an AI thermal. An attempt to refine the thermal shape and behaviour by WooT 2009
* SPDX-FileCopyrightText: Copyright (C) 2009 Patrice Poly ( WooT )
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
@ -30,13 +15,13 @@
#include <string>
class FGAIThermal : public FGAIBase {
class FGAIThermal : public FGAIBase
{
public:
FGAIThermal();
virtual ~FGAIThermal() = default;
string_view getTypeString(void) const override { return "thermal"; }
std::string_view getTypeString(void) const override { return "thermal"; }
void readFromScenario(SGPropertyNode* scFileNode) override;
bool init(ModelSearchOrder searchOrder) override;

View file

@ -1,21 +1,9 @@
// FGAIWingman - FGAIBllistic-derived class creates an AI Wingman
//
// Written by Vivian Meazza, started February 2008.
// - vivian.meazza at lineone.net
//
// 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: AIWingman.hxx
* SPDX-FileComment: AIBllistic-derived class creates an AI Wingman
* SPDX-FileCopyrightText: Written by Vivian Meazza, started February 2008 - vivian.meazza at lineone.net
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
@ -28,12 +16,13 @@
#include "AIManager.hxx"
class FGAIWingman : public FGAIBallistic {
class FGAIWingman : public FGAIBallistic
{
public:
FGAIWingman();
virtual ~FGAIWingman() = default;
string_view getTypeString(void) const override { return "wingman"; }
std::string_view getTypeString(void) const override { return "wingman"; }
void readFromScenario(SGPropertyNode* scFileNode) override;
bool init(ModelSearchOrder searchOrder) override;
@ -84,41 +73,50 @@ private:
inline SGVec3d getCartInPos(SGGeod in_pos) const;
};
void FGAIWingman::setFormate(bool f) {
void FGAIWingman::setFormate(bool f)
{
_formate_to_ac = f;
}
void FGAIWingman::setTgtHdg(double h) {
void FGAIWingman::setTgtHdg(double h)
{
tgt_heading = h;
}
void FGAIWingman::setTgtSpd(double s) {
void FGAIWingman::setTgtSpd(double s)
{
tgt_speed = s;
}
void FGAIWingman::setBrkHdg(double a){
void FGAIWingman::setBrkHdg(double a)
{
tgt_heading = hdg + a;
SG_NORMALIZE_RANGE(tgt_heading, 0.0, 360.0);
}
void FGAIWingman::setBrkAng(double a){
void FGAIWingman::setBrkAng(double a)
{
_break_angle = a;
SG_NORMALIZE_RANGE(_break_angle, -180.0, 180.0);
}
void FGAIWingman::setCoeffHdg(double h){
void FGAIWingman::setCoeffHdg(double h)
{
_coeff_hdg = h;
}
void FGAIWingman::setCoeffPch(double p){
void FGAIWingman::setCoeffPch(double p)
{
_coeff_pch = p;
}
void FGAIWingman::setCoeffBnk(double b){
void FGAIWingman::setCoeffBnk(double b)
{
_coeff_bnk = b;
}
void FGAIWingman::setCoeffSpd(double s){
void FGAIWingman::setCoeffSpd(double s)
{
_coeff_spd = s;
}
@ -138,7 +136,8 @@ void FGAIWingman::setCoeffSpd(double s){
// return _break_angle;
//}
SGVec3d FGAIWingman::getCartInPos(SGGeod in_pos) const {
SGVec3d FGAIWingman::getCartInPos(SGGeod in_pos) const
{
SGVec3d cartPos = SGVec3d::fromGeod(in_pos);
return cartPos;
}