1
0
Fork 0

ATC / AI subsystem: replace iostream with SG_LOG() and make new function in SchedFlight that will create a new scheduled flight instance

This commit is contained in:
legoboyvdlp R 2019-06-14 20:31:04 +01:00 committed by James Turner
parent d2a04cecf7
commit 4af75c4666
9 changed files with 157 additions and 155 deletions

View file

@ -20,8 +20,6 @@
# include <config.h>
#endif
#include <iostream>
#include <simgear/misc/sg_path.hxx>
#include <simgear/debug/logstream.hxx>
#include <simgear/math/sg_geodesy.hxx>
@ -47,7 +45,6 @@
#include "AIFlightPlan.hxx"
#include "AIAircraft.hxx"
using std::cerr;
using std::string;
FGAIWaypoint::FGAIWaypoint() {
@ -379,8 +376,8 @@ void FGAIFlightPlan::setLeadDistance(double speed, double bearing,
lead_distance = turn_radius * tan((leadInAngle * SG_DEGREES_TO_RADIANS)/2);
/*
if ((lead_distance > (3*turn_radius)) && (current->on_ground == false)) {
// cerr << "Warning: Lead-in distance is large. Inbound = " << inbound
// << ". Outbound = " << outbound << ". Lead in angle = " << leadInAngle << ". Turn radius = " << turn_radius << endl;
SG_LOG(SG_AI, SG_ALERT, "Warning: Lead-in distance is large. Inbound = " << inbound
<< ". Outbound = " << outbound << ". Lead in angle = " << leadInAngle << ". Turn radius = " << turn_radius);
lead_distance = 3 * turn_radius;
return;
}
@ -431,7 +428,7 @@ void FGAIFlightPlan::resetWaypoints()
wpt->setFlaps_down ( (*i)->getFlaps_down() );
wpt->setFinished ( false );
wpt->setOn_ground ( (*i)->getOn_ground() );
//cerr << "Recycling waypoint " << wpt->name << endl;
SG_LOG(SG_AI, SG_DEBUG, "Recycling waypoint " << wpt->getName());
deleteWaypoints();
pushBackWaypoint(wpt);
}

View file

@ -24,7 +24,6 @@
#endif
#include <fstream>
#include <iostream>
#include <Airports/airport.hxx>
#include <Airports/runways.hxx>
@ -39,7 +38,6 @@
#include "AIAircraft.hxx"
#include "performancedata.hxx"
using std::iostream;
using std::string;
/*
@ -135,7 +133,7 @@ void FGAIFlightPlan::createCruise(bool firstFlight, FGAirport *dep,
dep->getId().c_str(),
arr->getId().c_str());
routefile.append(buffer);
cerr << "trying to read " << routefile.c_str()<< endl;
SG_LOG(SG_AI, SG_DEBUG, "trying to read " << routefile.c_str());
//exit(1);
if (routefile.exists())
{
@ -157,14 +155,14 @@ void FGAIFlightPlan::createCruise(bool firstFlight, FGAirport *dep,
int node;
if (route.empty()) {
// if no route could be found, create a direct gps route...
cerr << "still no route found from " << dep->getName() << " to << " << arr->getName() <<endl;
SG_LOG(SG_AI, SG_DEBUG, "still no route found from " << dep->getName() << " to << " << arr->getName());
//exit(1);
} else {
while(route.next(&node))
{
FGNode *fn = globals->get_airwaynet()->findNode(node);
//cerr << "Checking status of each waypoint: " << fn->getIdent();
SG_LOG(SG_AI, SG_BULK, "Checking status of each waypoint: " << fn->getIdent());
SGWayPoint first(init_waypoint->longitude,
init_waypoint->latitude,
@ -192,23 +190,23 @@ void FGAIFlightPlan::createCruise(bool firstFlight, FGAirport *dep,
// in our flight plan:
// 1) current waypoint is less then 100 miles away OR
// 2) curren waypoint is ahead of us, at any distance
//cerr << " Distance : " << dist << " : Course diff " << crsDiff
// << " crs to dest : " << course
// << " crs to wpt : " << crse;
SG_LOG(SG_AI, SG_BULK, " Distance : " << dist << " : Course diff " << crsDiff
<< " crs to dest : " << course
<< " crs to wpt : " << crse);
if ((dist > 20.0) && (crsDiff > 90.0))
{
//useWpt = false;
// Once we start including waypoints, we have to continue, even though
// one of the following way point would suffice.
// so once is the useWpt flag is set to true, we cannot reset it to false.
//cerr << " discarding " << endl;
SG_LOG(SG_AI, SG_BULK, " discarding ");
// << ": Course difference = " << crsDiff
// << "Course = " << course
// << "crse = " << crse << endl;
// << "crse = " << crse);
}
else {
//i = ids.end()-1;
//cerr << " accepting " << endl;
SG_LOG(SG_AI, SG_BULK, " accepting ")
//ids.pop_back();
wpt = new waypoint;
@ -240,7 +238,7 @@ void FGAIFlightPlan::createCruise(bool firstFlight, FGAirport *dep,
activeRunway,
&rwy)))
{
cout << "Failed to find runway for " << arr->getId() << endl;
SG_LOG(SG_AI, SG_WARN, "Failed to find runway for " << arr->getId());
// Hmm, how do we handle a potential error like this?
exit(1);
}
@ -248,12 +246,9 @@ void FGAIFlightPlan::createCruise(bool firstFlight, FGAirport *dep,
//arr->getActiveRunway(string("com"), 1, test);
//exit(1);
//cerr << "Altitude = " << alt << endl;
//cerr << "Done" << endl;
//if (arr->getId() == "EHAM")
// {
// cerr << "Creating cruise to EHAM " << latitude << " " << longitude << endl;
// }
SG_LOG(SG_AI, SG_DEBUG, "Altitude = " << alt);
SG_LOG(SG_AI, SG_DEBUG, "Done");
SG_LOG(SG_AI, SG_DEBUG, "Creating cruise to " << arr->getId() << " " << latitude << " " << longitude);
heading = rwy._heading;
azimuth = heading + 180.0;
while ( azimuth >= 360.0 ) { azimuth -= 360.0; }

View file

@ -52,7 +52,7 @@ bool FGAIFlightPlan::createPushBack(FGAIAircraft *ac,
double vTaxi = ac->getPerformance()->vTaxi();
double vTaxiBackward = vTaxi * (-2.0/3.0);
double vTaxiReduced = vTaxi * (2.0/3.0);
// Active runway can be conditionally set by ATC, so at the start of a new flight, this
// must be reset.
activeRunway.clear();

View file

@ -13,12 +13,10 @@
#include <Main/globals.hxx>
#include <cstring>
#include <iostream>
#include <fstream>
#include "performancedata.hxx"
using std::string;
using std::cerr;
PerformanceDB::PerformanceDB()
{

View file

@ -186,17 +186,17 @@ bool FGGroundController::checkTransmissionState(int minState, int maxState, Traf
int state = i->getState();
if ((state >= minState) && (state <= maxState) && available) {
if ((msgDir == ATC_AIR_TO_GROUND) && isUserAircraft(i->getAircraft())) {
//cerr << "Checking state " << state << " for " << i->getAircraft()->getCallSign() << endl;
SG_LOG(SG_ATC, SG_DEBUG, "Checking state " << state << " for " << i->getAircraft()->getCallSign());
SGPropertyNode_ptr trans_num = globals->get_props()->getNode("/sim/atc/transmission-num", true);
int n = trans_num->getIntValue();
if (n == 0) {
trans_num->setIntValue(-1);
// PopupCallback(n);
//cerr << "Selected transmission message " << n << endl;
SG_LOG(SG_ATC, SG_DEBUG, "Selected transmission message " << n);
//FGATCManager *atc = (FGATCManager*) globals->get_subsystem("atc");
FGATCDialogNew::instance()->removeEntry(1);
} else {
//cerr << "creating message for " << i->getAircraft()->getCallSign() << endl;
SG_LOG(SG_ATC, SG_DEBUG, "creating message for " << i->getAircraft()->getCallSign());
transmit(&(*i), dynamics, msgId, msgDir, false);
return false;
}
@ -362,7 +362,7 @@ void FGGroundController::checkSpeedAdjustment(int id, double lat,
for (TrafficVectorIterator i =
towerController->getActiveTraffic().begin();
i != towerController->getActiveTraffic().end(); i++) {
//cerr << "Comparing " << current->getId() << " and " << i->getId() << endl;
SG_LOG(SG_ATC, SG_BULK, "Comparing " << current->getId() << " and " << i->getId());
SGGeod other(SGGeod::fromDegM(i->getLongitude(),
i->getLatitude(),
i->getAltitude()));
@ -371,10 +371,9 @@ void FGGroundController::checkSpeedAdjustment(int id, double lat,
if (bearing > 180)
bearing = 360 - bearing;
if ((dist < mindist) && (bearing < 60.0)) {
//cerr << "Current aircraft " << current->getAircraft()->getTrafficRef()->getCallSign()
// << " is closest to " << i->getAircraft()->getTrafficRef()->getCallSign()
// << ", which has status " << i->getAircraft()->isScheduledForTakeoff()
// << endl;
//SG_LOG(SG_ATC, SG_BULK, "Current aircraft " << current->getAircraft()->getTrafficRef()->getCallSign()
// << " is closest to " << i->getAircraft()->getTrafficRef()->getCallSign()
// << ", which has status " << i->getAircraft()->isScheduledForTakeoff());
mindist = dist;
closest = i;
// minbearing = bearing;
@ -481,7 +480,7 @@ void FGGroundController::checkHoldPosition(int id, double lat,
return;
}
if (current->getAircraft()->getTakeOffStatus() == 2) {
//cerr << current->getAircraft()->getCallSign() << ". Taxi in position and hold" << endl;
SG_LOG(SG_ATC, SG_DEBUG, current->getAircraft()->getCallSign() << ". Taxi in position and hold");
current->setHoldPosition(false);
current->clearSpeedAdjustment();
return;
@ -536,21 +535,21 @@ void FGGroundController::checkHoldPosition(int id, double lat,
}
if (current->getState() == 0) {
if ((origStatus != currStatus) && available) {
//cerr << "Issueing hold short instrudtion " << currStatus << " " << available << endl;
SG_LOG(SG_ATC, SG_DEBUG, "Issuing hold short instruction " << currStatus << " " << available);
if (currStatus == true) { // No has a hold short instruction
transmit(&(*current), dynamics, MSG_HOLD_POSITION, ATC_GROUND_TO_AIR, true);
//cerr << "Transmittin hold short instrudtion " << currStatus << " " << available << endl;
SG_LOG(SG_ATC, SG_DEBUG, "Transmitting hold short instruction " << currStatus << " " << available);
current->setState(1);
} else {
transmit(&(*current), dynamics, MSG_RESUME_TAXI, ATC_GROUND_TO_AIR, true);
//cerr << "Transmittig resume instrudtion " << currStatus << " " << available << endl;
SG_LOG(SG_ATC, SG_DEBUG, "Transmitting resume instruction " << currStatus << " " << available);
current->setState(2);
}
lastTransmission = now;
available = false;
// Don't act on the changed instruction until the transmission is confirmed
// So set back to original status
//cerr << "Current state " << current->getState() << endl;
SG_LOG(SG_ATC, SG_DEBUG, "Current state " << current->getState());
}
}
@ -569,7 +568,7 @@ void FGGroundController::checkHoldPosition(int id, double lat,
current->setHoldPosition(false);
}
if (current->getAircraft()->getTakeOffStatus() && (current->getState() == 0)) {
//cerr << "Scheduling " << current->getAircraft()->getCallSign() << " for hold short" << endl;
SG_LOG(SG_ATC, SG_DEBUG, "Scheduling " << current->getAircraft()->getCallSign() << " for hold short");
current->setState(6);
}
if (checkTransmissionState(6,6, current, now, MSG_REPORT_RUNWAY_HOLD_SHORT, ATC_AIR_TO_GROUND)) {
@ -602,7 +601,7 @@ void FGGroundController::checkHoldPosition(int id, double lat,
bool FGGroundController::checkForCircularWaits(int id)
{
//cerr << "Performing Wait check " << id << endl;
SG_LOG(SG_ATC, SG_DEBUG, "Performing Wait check " << id);
int target = 0;
TrafficVectorIterator current, other;
TrafficVectorIterator i = activeTraffic.begin();
@ -628,7 +627,7 @@ bool FGGroundController::checkForCircularWaits(int id)
int counter = 0;
if (id == target) {
//cerr << "aircraft waits for user" << endl;
SG_LOG(SG_ATC, SG_DEBUG, "aircraft waits for user");
return false;
}
@ -648,9 +647,9 @@ bool FGGroundController::checkForCircularWaits(int id)
return false;
}
if (i == activeTraffic.end() || (trafficSize == 0)) {
//cerr << "[Waiting for traffic at Runway: DONE] " << endl << endl;;
SG_LOG(SG_ATC, SG_DEBUG, "[Waiting for traffic at Runway: DONE] ");
// The target id is not found on the current network, which means it's at the tower
//SG_LOG(SG_GENERAL, SG_ALERT, "AI error: Trying to access non-existing aircraft in FGGroundNetwork::checkForCircularWaits");
SG_LOG(SG_ATC, SG_ALERT, "AI error: Trying to access non-existing aircraft in FGGroundNetwork::checkForCircularWaits");
return false;
}
other = i;
@ -660,20 +659,20 @@ bool FGGroundController::checkForCircularWaits(int id)
// the setWaitsForID(id) is set to current when the aircraft
// is waiting for the user controlled aircraft.
//if (current->getId() == other->getId()) {
// cerr << "Caught the impossible trap" << endl;
// cerr << "Current = " << current->getId() << endl;
// cerr << "Other = " << other ->getId() << endl;
// SG_LOG(SG_ATC, SG_DEBUG, "Caught the impossible trap");
// SG_LOG(SG_ATC, SG_DEBUG, "Current = " << current->getId());
// SG_LOG(SG_ATC, SG_DEBUG, "Other = " << other ->getId());
// for (TrafficVectorIterator at = activeTraffic.begin();
// at != activeTraffic.end();
// at++) {
// cerr << "currently active aircraft : " << at->getCallSign() << " with Id " << at->getId() << " waits for " << at->getWaitsForId() << endl;
// SG_LOG(SG_ATC, SG_BULK, "currently active aircraft : " << at->getCallSign() << " with Id " << at->getId() << " waits for " << at->getWaitsForId());
// }
// exit(1);
if (current->getId() == other->getId())
return false;
//}
//cerr << current->getCallSign() << " (" << current->getId() << ") " << " -> " << other->getCallSign()
// << " (" << other->getId() << "); " << endl;;
//SG_LOG(SG_ATC, SG_DEBUG, current->getCallSign() << " (" << current->getId() << ") " << " -> " << other->getCallSign()
// << " (" << other->getId() << "); ");
//current = other;
}
@ -683,7 +682,7 @@ bool FGGroundController::checkForCircularWaits(int id)
//if (printed)
// cerr << "[done] " << endl << endl;;
SG_LOG(SG_ATC, SG_DEBUG, "[done] ");
if (id == target) {
SG_LOG(SG_GENERAL, SG_WARN,
"Detected circular wait condition: Id = " << id <<
@ -767,7 +766,7 @@ void FGGroundController::render(bool visible)
//int nr = ;
globals->get_scenery()->get_scene_graph()->removeChild(group);
//while (group->getNumChildren()) {
// cerr << "Number of children: " << group->getNumChildren() << endl;
// SG_LOG(SG_ATC, SG_DEBUG, "Number of children: " << group->getNumChildren());
//simgear::EffectGeode* geode = (simgear::EffectGeode*) group->getChild(0);
//osg::MatrixTransform *obj_trans = (osg::MatrixTransform*) group->getChild(0);
//geode->releaseGLObjects();
@ -802,7 +801,7 @@ void FGGroundController::render(bool visible)
double coveredDistance = length * 0.5;
SGGeod center;
SGGeodesy::direct(start, heading, coveredDistance, center, az2);
//std::cerr << "Active Aircraft : Centerpoint = (" << center.getLatitudeDeg() << ", " << center.getLongitudeDeg() << "). Heading = " << heading << std::endl;
SG_LOG(SG_ATC, SG_BULK, "Active Aircraft : Centerpoint = (" << center.getLatitudeDeg() << ", " << center.getLongitudeDeg() << "). Heading = " << heading);
///////////////////////////////////////////////////////////////////////////////
// Make a helper function out of this
osg::Matrix obj_pos;
@ -816,7 +815,7 @@ void FGGroundController::render(bool visible)
elevationStart = ((i)->getAircraft()->_getAltitude());
}
double elevationEnd = segment->getEnd()->getElevationM();
//cerr << "Using elevation " << elevationEnd << endl;
SG_LOG(SG_ATC, SG_DEBUG, "Using elevation " << elevationEnd);
if ((elevationEnd == 0) || (elevationEnd = parent->getElevation())) {
SGGeod center2 = end;
@ -835,7 +834,7 @@ void FGGroundController::render(bool visible)
double slope = atan2(elevDiff, length) * SGD_RADIANS_TO_DEGREES;
//cerr << "1. Using mean elevation : " << elevationMean << " and " << slope << endl;
SG_LOG(SG_ATC, SG_DEBUG, "1. Using mean elevation : " << elevationMean << " and " << slope);
WorldCoordinate( obj_pos, center.getLatitudeDeg(), center.getLongitudeDeg(), elevationMean+ 0.5, -(heading), slope );
@ -866,7 +865,7 @@ void FGGroundController::render(bool visible)
group->addChild( obj_trans );
/////////////////////////////////////////////////////////////////////
} else {
//std::cerr << "BIG FAT WARNING: current position is here : " << pos << std::endl;
SG_LOG(SG_ATC, SG_INFO, "BIG FAT WARNING: current position is here : " << pos);
}
// Next: Draw the other taxi segments.
for (intVecIterator j = (i)->getIntentions().begin(); j != (i)->getIntentions().end(); j++) {
@ -909,7 +908,7 @@ void FGGroundController::render(bool visible)
double length = segmentK->getLength();
double slope = atan2(elevDiff, length) * SGD_RADIANS_TO_DEGREES;
// cerr << "2. Using mean elevation : " << elevationMean << " and " << slope << endl;
SG_LOG(SG_ATC, SG_DEBUG, "2. Using mean elevation : " << elevationMean << " and " << slope);
SGGeod segCenter = segmentK->getCenter();
WorldCoordinate( obj_pos, segCenter.getLatitudeDeg(), segCenter.getLongitudeDeg(),

View file

@ -24,8 +24,6 @@
# include "config.h"
#endif
#include <iostream>
#include <Airports/dynamics.hxx>
#include <Airports/airportdynamicsmanager.hxx>
#include <Airports/airport.hxx>
@ -67,37 +65,41 @@ void FGATCManager::postinit()
// Starting in the Air
bool onGround = fgGetBool("/sim/presets/onground");
string runway = fgGetString("/sim/atc/runway");
string airport = fgGetString("/sim/presets/airport-id");
string curAirport = fgGetString("/sim/presets/airport-id");
string destination = fgGetString("/autopilot/route-manager/destination/airport");
string parking = fgGetString("/sim/presets/parkpos");
FGAIManager* aiManager = globals->get_subsystem<FGAIManager>();
FGAIAircraft* userAircraft = aiManager->getUserAircraft();
string callsign = userAircraft->getCallSign();
double aircraftRadius = 40; // note that this is currently hardcoded to a one-size-fits all JumboJet value. Should change later;
// In case a destination is not set yet, make it equal to the current airport
if (destination == "") {
destination = curAirport;
}
// NEXT UP: Create a traffic Schedule and fill that with appropriate information. This we can use to flight planning.
// Note that these are currently only defaults.
FGAISchedule *trafficRef = new FGAISchedule;
trafficRef->setFlightType("gate");
FGScheduledFlight *flight = new FGScheduledFlight;
flight->setDepartureAirport(airport);
flight->setArrivalAirport(airport);
flight->initializeAirports();
flight->setFlightRules("IFR");
flight->setCallSign(userAircraft->getCallSign());
FGScheduledFlight* flight = createScheduledFlightWithInfo(curAirport, destination, "IFR", callsign);
trafficRef->assign(flight);
std::unique_ptr<FGAIFlightPlan> fp ;
userAircraft->setTrafficRef(trafficRef);
string flightPlanName = airport + "-" + airport + ".xml";
string flightPlanName = curAirport + "-" + destination + ".xml";
//double cruiseAlt = 100; // Doesn't really matter right now.
//double courseToDest = 180; // Just use something neutral; this value might affect the runway that is used though...
//time_t deptime = 0; // just make sure how flightplan processing is affected by this...
FGAirportDynamicsRef dcs(flightgear::AirportDynamicsManager::find(airport));
FGAirportDynamicsRef dcs(flightgear::AirportDynamicsManager::find(curAirport));
if (dcs && onGround) {// && !runway.empty()) {
ParkingAssignment pk;
@ -133,7 +135,7 @@ void FGATCManager::postinit()
int stationFreq = dcs->getGroundFrequency(1);
if (stationFreq > 0)
{
//cerr << "Setting radio frequency to : " << stationFreq << endl;
SG_LOG(SG_ATC, SG_DEBUG, "Setting radio frequency to : " << stationFreq);
fgSetDouble("/instrumentation/comm[0]/frequencies/selected-mhz", ((double) stationFreq / 100.0));
}
leg = 1;
@ -164,7 +166,7 @@ void FGATCManager::postinit()
int stationFreq = dcs->getTowerFrequency(2);
if (stationFreq > 0)
{
//cerr << "Setting radio frequency to in airfrequency: " << stationFreq << endl;
SG_LOG(SG_ATC, SG_DEBUG, "Setting radio frequency to inair frequency : " << stationFreq);
fgSetDouble("/instrumentation/comm[0]/frequencies/selected-mhz", ((double) stationFreq / 100.0));
}
fp.reset(new FGAIFlightPlan);
@ -223,50 +225,50 @@ void FGATCManager::removeController(FGATCController *controller)
}
void FGATCManager::update ( double time ) {
//cerr << "ATC update code is running at time: " << time << endl;
SG_LOG(SG_ATC, SG_BULK, "ATC update code is running at time: " << time);
// Test code: let my virtual co-pilot handle ATC:
FGAIManager* aiManager = globals->get_subsystem<FGAIManager>();
FGAIAircraft* ai_ac = aiManager->getUserAircraft();
FGAIFlightPlan *fp = ai_ac->GetFlightPlan();
/* test code : find out how the routing develops */
if (fp) {
int size = fp->getNrOfWayPoints();
//cerr << "Setting pos" << pos << " ";
//cerr << "setting intentions " ;
//SG_LOG(SG_ATC, SG_DEBUG, "Setting pos" << pos << " ");
//SG_LOG(SG_ATC, SG_DEBUG, "Setting intentions");
// This indicates that we have run out of waypoints: Im future versions, the
// user should be able to select a new route, but for now just shut down the
// system.
if (size < 3) {
//cerr << "Shutting down the atc_mgr" << endl;
SG_LOG(SG_ATC, SG_INFO, "Shutting down the atc_mgr - ran out of waypoints");
return;
}
#if 0
// Test code: Print how far we're progressing along the taxi route.
//std::cerr << "Size of waypoint cue " << size << " ";
SG_LOG(SG_ATC, SG_DEBUG, "Size of waypoint cue " << size);
for (int i = 0; i < size; i++) {
int val = fp->getRouteIndex(i);
//std::cerr << fp->getWayPoint(i)->getName() << " ";
SG_LOG(SG_ATC, SG_BULK, fp->getWayPoint(i)->getName() << " ");
//if ((val) && (val != pos)) {
// intentions.push_back(val);
// std::cerr << "[done ] " << std::endl;
SG_LOG(SG_ATC, SG_BULK, "[done ]");
//}
}
//std::cerr << "[done ] " << std::endl;
SG_LOG(SG_ATC, SG_BULK, "[done ]");
#endif
}
if (fp) {
//cerr << "Currently at leg : " << fp->getLeg() << endl;
SG_LOG(SG_ATC, SG_DEBUG, "Currently at leg : " << fp->getLeg());
}
controller = ai_ac->getATCController();
FGATCDialogNew::instance()->update(time);
if (controller) {
//cerr << "name of previous waypoint : " << fp->getPreviousWaypoint()->getName() << endl;
SG_LOG(SG_ATC, SG_DEBUG, "name of previous waypoint : " << fp->getPreviousWaypoint()->getName());
//cerr << "Running FGATCManager::update()" << endl;
//cerr << "Currently under control of " << controller->getName() << endl;
SG_LOG(SG_ATC, SG_DEBUG, "Currently under control of " << controller->getName());
controller->updateAircraftInformation(ai_ac->getID(),
ai_ac->_getLatitude(),
ai_ac->_getLongitude(),
@ -278,7 +280,7 @@ void FGATCManager::update ( double time ) {
// AT this stage we should update the flightplan, so that waypoint incrementing is conducted as well as leg loading.
int n = trans_num->getIntValue();
if (n == 1) {
//cerr << "Toggling ground network visibility " << networkVisible << endl;
SG_LOG(SG_ATC, SG_DEBUG, "Toggling ground network visibility " << networkVisible);
networkVisible = !networkVisible;
trans_num->setIntValue(-1);
}
@ -287,7 +289,7 @@ void FGATCManager::update ( double time ) {
}
controller->render(networkVisible);
//cerr << "Adding groundnetWork to the scenegraph::update" << endl;
SG_LOG(SG_ATC, SG_DEBUG, "Adding groundnetWork to the scenegraph::update");
prevController = controller;
}
for (AtcVecIterator atc = activeStations.begin(); atc != activeStations.end(); atc++) {

View file

@ -55,8 +55,6 @@
using std::sort;
using std::string;
using std::cout;
using std::endl;
namespace {
@ -83,26 +81,26 @@ time_t ActiveRunway::requestTimeSlot(time_t eta)
return eta;
} else {
TimeVectorIterator i = estimatedArrivalTimes.begin();
//cerr << "Checking eta slots " << eta << ": " << endl;
SG_LOG(SG_ATC, SG_DEBUG, "Checking eta slots " << eta << ": ");
for (i = estimatedArrivalTimes.begin();
i != estimatedArrivalTimes.end(); i++) {
//cerr << "Stored time : " << (*i) << endl;
SG_LOG(SG_ATC, SG_BULK, "Stored time : " << (*i));
}
i = estimatedArrivalTimes.begin();
if ((eta + separation) < (*i)) {
newEta = eta;
found = true;
//cerr << "Storing at beginning" << endl;
SG_LOG(SG_ATC, SG_BULK, "Storing at beginning");
}
while ((i != estimatedArrivalTimes.end()) && (!found)) {
TimeVectorIterator j = i + 1;
if (j == estimatedArrivalTimes.end()) {
if (((*i) + separation) < eta) {
//cerr << "Storing at end" << endl;
SG_LOG(SG_ATC, SG_BULK, "Storing at end");
newEta = eta;
} else {
newEta = (*i) + separation;
//cerr << "Storing at end + separation" << endl;
SG_LOG(SG_ATC, SG_BULK, "Storing at end + separation");
}
} else {
if ((((*j) - (*i)) > (separation * 2))) { // found a potential slot
@ -110,30 +108,30 @@ time_t ActiveRunway::requestTimeSlot(time_t eta)
// 1) eta should fall between the two points
// i.e. eta > i AND eta < j
//
//cerr << "Found potential slot after " << (*i) << endl;
SG_LOG(SG_ATC, SG_DEBUG, "Found potential slot after " << (*i));
if (eta > (*i) && (eta < (*j))) {
found = true;
if (eta < ((*i) + separation)) {
newEta = (*i) + separation;
//cerr << "Using original" << (*i) << " + separation " << endl;
SG_LOG(SG_ATC, SG_BULK, "Using original" << (*i) << " + separation ");
} else {
newEta = eta;
//cerr << "Using original after " << (*i) << endl;
SG_LOG(SG_ATC, SG_BULK, "Using original after " << (*i));
}
} else if (eta < (*i)) {
found = true;
newEta = (*i) + separation;
//cerr << "Using delayed slot after " << (*i) << endl;
SG_LOG(SG_ATC, SG_BULK, "Using delayed slot after " << (*i));
}
/*
if (((*j) - separation) < eta) {
found = true;
if (((*i) + separation) < eta) {
newEta = eta;
cerr << "Using original after " << (*i) << endl;
SG_LOG(SG_ATC, SG_BULK, "Using original after " << (*i));
} else {
newEta = (*i) + separation;
cerr << "Using " << (*i) << " + separation " << endl;
SG_LOG(SG_ATC, SG_BULK, "Using " << (*i) << " + separation ");
}
} */
}
@ -141,7 +139,7 @@ time_t ActiveRunway::requestTimeSlot(time_t eta)
i++;
}
}
//cerr << ". done. New ETA : " << newEta << endl;
SG_LOG(SG_ATC, SG_DEBUG, "Done. New ETA : " << newEta);
estimatedArrivalTimes.push_back(newEta);
sort(estimatedArrivalTimes.begin(), estimatedArrivalTimes.end());
@ -152,7 +150,7 @@ time_t ActiveRunway::requestTimeSlot(time_t eta)
TimeVectorIterator i = estimatedArrivalTimes.begin();
while (i != estimatedArrivalTimes.end()) {
if ((*i) < now) {
//cerr << "Deleting timestamp " << (*i) << " (now = " << now << "). " << endl;
SG_LOG(SG_ATC, SG_BULK, "Deleting timestamp " << (*i) << " (now = " << now << "). ");
estimatedArrivalTimes.erase(i);
i = estimatedArrivalTimes.begin();
} else {
@ -164,10 +162,10 @@ time_t ActiveRunway::requestTimeSlot(time_t eta)
void ActiveRunway::printDepartureCue()
{
cout << "Departure cue for " << rwy << ": " << endl;
SG_LOG(SG_ATC, SG_DEBUG, "Departure cue for " << rwy << ": ");
for (AircraftVecIterator atc = departureCue.begin(); atc != departureCue.end(); atc++) {
cout << " " << (*atc)->getCallSign() << " " << (*atc)->getTakeOffStatus();
cout << " " << (*atc)->_getLatitude() << " " << (*atc)->_getLongitude() << (*atc)-> getSpeed() << " " << (*atc)->getAltitude() << endl;
SG_LOG(SG_ATC, SG_DEBUG, " " << (*atc)->getCallSign() << " " << (*atc)->getTakeOffStatus());
SG_LOG(SG_ATC, SG_DEBUG, " " << (*atc)->_getLatitude() << " " << (*atc)->_getLongitude() << (*atc)->getSpeed() << " " << (*atc)->getAltitude());
}
}
@ -219,8 +217,8 @@ void FGTrafficRecord::setPositionAndIntentions(int pos,
} else {
//FGAIFlightPlan::waypoint* const wpt= route->getCurrentWaypoint();
int size = route->getNrOfWayPoints();
//cerr << "Setting pos" << pos << " ";
//cerr << "setting intentions ";
SG_LOG(SG_ATC, SG_DEBUG, "Setting pos" << pos);
SG_LOG(SG_ATC, SG_DEBUG, "Setting intentions");
for (int i = 2; i < size; i++) {
int val = route->getRouteIndex(i);
intentions.push_back(val);
@ -247,23 +245,23 @@ FGAIAircraft* FGTrafficRecord::getAircraft() const
bool FGTrafficRecord::checkPositionAndIntentions(FGTrafficRecord & other)
{
bool result = false;
//cerr << "Start check 1" << endl;
SG_LOG(SG_ATC, SG_BULK, "Start check 1");
if (currentPos == other.currentPos) {
//cerr << callsign << ": Check Position and intentions: we are on the same taxiway" << other.callsign << "Index = " << currentPos << endl;
SG_LOG(SG_ATC, SG_DEBUG, ": Check Position and intentions: we are on the same taxiway; Index = " << currentPos);
result = true;
}
// else if (! other.intentions.empty())
// {
// cerr << "Start check 2" << endl;
// SG_LOG(SG_ATC, SG_BULK, "Start check 2");
// intVecIterator i = other.intentions.begin();
// while (!((i == other.intentions.end()) || ((*i) == currentPos)))
// i++;
// if (i != other.intentions.end()) {
// cerr << "Check Position and intentions: current matches other.intentions" << endl;
// SG_LOG(SG_ATC, SG_BULK, "Check Position and intentions: current matches other.intentions");
// result = true;
// }
else if (! intentions.empty()) {
//cerr << "Start check 3" << endl;
SG_LOG(SG_ATC, SG_BULK, "Start check 3");
intVecIterator i = intentions.begin();
//while (!((i == intentions.end()) || ((*i) == other.currentPos)))
while (i != intentions.end()) {
@ -273,11 +271,11 @@ bool FGTrafficRecord::checkPositionAndIntentions(FGTrafficRecord & other)
i++;
}
if (i != intentions.end()) {
//cerr << callsign << ": Check Position and intentions: .other.current matches" << other.callsign << "Index = " << (*i) << endl;
SG_LOG(SG_ATC, SG_DEBUG, ": Check Position and intentions: .other.current matches Index = " << (*i));
result = true;
}
}
//cerr << "Done !!" << endl;
SG_LOG(SG_ATC, SG_BULK, "Done!");
return result;
}
@ -311,7 +309,7 @@ int FGTrafficRecord::crosses(FGGroundNetwork * net,
if ((*i) > 0) {
if (currentTargetNode ==
net->findSegment(*i)->getEnd()->getIndex()) {
//cerr << "Current crosses at " << currentTargetNode <<endl;
SG_LOG(SG_ATC, SG_BULK, "Current crosses at " << currentTargetNode);
return currentTargetNode;
}
}
@ -323,7 +321,7 @@ int FGTrafficRecord::crosses(FGGroundNetwork * net,
if ((*i) > 0) {
if (otherTargetNode ==
net->findSegment(*i)->getEnd()->getIndex()) {
//cerr << "Other crosses at " << currentTargetNode <<endl;
SG_LOG(SG_ATC, SG_BULK, "Other crosses at " << currentTargetNode);
return otherTargetNode;
}
}
@ -333,14 +331,14 @@ int FGTrafficRecord::crosses(FGGroundNetwork * net,
for (i = intentions.begin(); i != intentions.end(); i++) {
for (j = other.intentions.begin(); j != other.intentions.end();
j++) {
//cerr << "finding segment " << *i << " and " << *j << endl;
SG_LOG(SG_ATC, SG_BULK, "finding segment " << *i << " and " << *j);
if (((*i) > 0) && ((*j) > 0)) {
currentTargetNode =
net->findSegment(*i)->getEnd()->getIndex();
otherTargetNode =
net->findSegment(*j)->getEnd()->getIndex();
if (currentTargetNode == otherTargetNode) {
//cerr << "Routes will cross at " << currentTargetNode << endl;
SG_LOG(SG_ATC, SG_BULK, "Routes will cross at " << currentTargetNode);
return currentTargetNode;
}
}
@ -394,7 +392,7 @@ bool FGTrafficRecord::isOpposing(FGGroundNetwork * net,
{
// Check if current segment is the reverse segment for the other aircraft
FGTaxiSegment *opp;
//cerr << "Current segment " << currentPos << endl;
SG_LOG(SG_ATC, SG_BULK, "Current segment " << currentPos);
if ((currentPos > 0) && (other.currentPos > 0)) {
opp = net->findSegment(currentPos)->opposite();
if (opp) {
@ -411,7 +409,7 @@ bool FGTrafficRecord::isOpposing(FGGroundNetwork * net,
if (net->findSegment(*i)->getStart()->getIndex() ==
node) {
{
//cerr << "Found the node " << node << endl;
SG_LOG(SG_ATC, SG_BULK, "Found the node " << node);
return true;
}
}
@ -420,19 +418,19 @@ bool FGTrafficRecord::isOpposing(FGGroundNetwork * net,
if (! other.intentions.empty()) {
for (intVecIterator j = other.intentions.begin();
j != other.intentions.end(); j++) {
// cerr << "Current segment 1 " << (*i) << endl;
SG_LOG(SG_ATC, SG_BULK, "Current segment 1 " << (*i));
if ((*i) > 0) {
if ((opp = net->findSegment(*i)->opposite())) {
if (opp->getIndex() ==
net->findSegment(*j)->getIndex()) {
//cerr << "Nodes " << net->findSegment(*i)->getIndex()
// << " and " << net->findSegment(*j)->getIndex()
// << " are opposites " << endl;
SG_LOG(SG_ATC, SG_BULK, "Nodes " << net->findSegment(*i)->getIndex()
<< " and " << net->findSegment(*j)->getIndex()
<< " are opposites ");
if (net->findSegment(*i)->getStart()->
getIndex() == node) {
{
//cerr << "Found the node " << node << endl;
return true;
SG_LOG(SG_ATC, SG_BULK, "Found the node " << node);
return true;
}
}
}
@ -512,7 +510,7 @@ bool FGATCInstruction::hasInstruction() const
FGATCController::FGATCController()
{
//cerr << "running FGATController constructor" << endl;
SG_LOG(SG_ATC, SG_DEBUG, "running FGATController constructor");
dt_count = 0;
available = true;
lastTransmission = 0;
@ -567,7 +565,8 @@ void FGATCController::transmit(FGTrafficRecord * rec, FGAirportDynamics *parent,
} else {
instructionText = "taxi";
}
//cerr << "transmitting for: " << sender << "Leg = " << rec->getLeg() << endl;
SG_LOG(SG_ATC, SG_DEBUG, "transmitting for: " << sender << "Leg = " << rec->getLeg());
switch (rec->getLeg()) {
case 1:
case 2:
@ -727,7 +726,7 @@ void FGATCController::transmit(FGTrafficRecord * rec, FGAirportDynamics *parent,
+ activeRunway
+ ". " + sender + ".";
//text = "test1";
//cerr << "1 Currently at leg " << rec->getLeg() << endl;
SG_LOG(SG_ATC, SG_DEBUG, "1 Currently at leg " << rec->getLeg());
break;
case MSG_ACKNOWLEDGE_REPORT_RUNWAY_HOLD_SHORT:
activeRunway = rec->getAircraft()->GetFlightPlan()->getRunway();
@ -735,19 +734,19 @@ void FGATCController::transmit(FGTrafficRecord * rec, FGAirportDynamics *parent,
// + activeRunway
+ ". " + sender + ".";
//text = "test2";
//cerr << "2 Currently at leg " << rec->getLeg() << endl;
SG_LOG(SG_ATC, SG_DEBUG, "2 Currently at leg " << rec->getLeg());
break;
case MSG_SWITCH_TOWER_FREQUENCY:
towerFreqStr = formatATCFrequency3_2(towerFreq);
text = receiver + " Contact Tower at " + towerFreqStr + ". " + sender + ".";
//text = "test3";
//cerr << "3 Currently at leg " << rec->getLeg() << endl;
SG_LOG(SG_ATC, SG_DEBUG, "3 Currently at leg " << rec->getLeg());
break;
case MSG_ACKNOWLEDGE_SWITCH_TOWER_FREQUENCY:
towerFreqStr = formatATCFrequency3_2(towerFreq);
text = receiver + " Roger, switching to tower at " + towerFreqStr + ". " + sender + ".";
//text = "test4";
//cerr << "4 Currently at leg " << rec->getLeg() << endl;
SG_LOG(SG_ATC, SG_DEBUG, "4 Currently at leg " << rec->getLeg());
break;
default:
//text = "test3";
@ -761,7 +760,7 @@ void FGATCController::transmit(FGTrafficRecord * rec, FGAirportDynamics *parent,
fgGetDouble("/instrumentation/comm[1]/frequencies/selected-mhz");
int onBoardRadioFreqI0 = (int) floor(onBoardRadioFreq0 * 100 + 0.5);
int onBoardRadioFreqI1 = (int) floor(onBoardRadioFreq1 * 100 + 0.5);
//cerr << "Using " << onBoardRadioFreq0 << ", " << onBoardRadioFreq1 << " and " << stationFreq << " for " << text << endl;
SG_LOG(SG_ATC, SG_DEBUG, "Using " << onBoardRadioFreq0 << ", " << onBoardRadioFreq1 << " and " << stationFreq << " for " << text << endl);
// Display ATC message only when one of the radios is tuned
// the relevant frequency.
@ -773,7 +772,7 @@ void FGATCController::transmit(FGTrafficRecord * rec, FGAirportDynamics *parent,
if (rec->allowTransmissions()) {
if( fgGetBool( "/sim/radio/use-itm-attenuation", false ) ) {
//cerr << "Using ITM radio propagation" << endl;
SG_LOG(SG_ATC, SG_DEBUG, "Using ITM radio propagation");
FGRadioTransmission* radio = new FGRadioTransmission();
SGGeod sender_pos;
double sender_alt_ft, sender_alt;
@ -916,7 +915,7 @@ void FGTowerController::announcePosition(int id,
rwy->addToDepartureCue(ref);
}
//cerr << ref->getTrafficRef()->getCallSign() << " You are number " << rwy->getDepartureCueSize() << " for takeoff " << endl;
SG_LOG(SG_ATC, SG_DEBUG, ref->getTrafficRef()->getCallSign() << " You are number " << rwy->getDepartureCueSize() << " for takeoff ");
} else {
i->setPositionAndHeading(lat, lon, heading, speed, alt);
}
@ -1050,7 +1049,7 @@ void FGTowerController::signOff(int id)
} else {
i->getAircraft()->resetTakeOffStatus();
i = activeTraffic.erase(i);
//cerr << "Signing off from tower controller" << endl;
SG_LOG(SG_ATC, SG_INFO, "Signing off from tower controller");
}
}
@ -1108,7 +1107,7 @@ FGATCInstruction FGTowerController::getInstruction(int id)
}
void FGTowerController::render(bool visible) {
//std::cerr << "FGTowerController::render function not yet implemented" << std::endl;
SG_LOG(SG_ATC, SG_INFO, "FGTowerController::render function not yet implemented");
}
string FGTowerController::getName() {
@ -1249,7 +1248,7 @@ void FGStartupController::signOff(int id)
SG_LOG(SG_ATC, SG_ALERT,
"AI error: Aircraft without traffic record is signing off from tower at " << SG_ORIGIN);
} else {
//cerr << i->getAircraft()->getCallSign() << " signing off from startupcontroller" << endl;
SG_LOG(SG_ATC, SG_DEBUG, i->getAircraft()->getCallSign() << " signing off from startupcontroller");
i = activeTraffic.erase(i);
}
}
@ -1261,22 +1260,22 @@ bool FGStartupController::checkTransmissionState(int st, time_t now, time_t star
if ((state == st) && available) {
if ((msgDir == ATC_AIR_TO_GROUND) && isUserAircraft(i->getAircraft())) {
//cerr << "Checking state " << st << " for " << i->getAircraft()->getCallSign() << endl;
SG_LOG(SG_ATC, SG_BULK, "Checking state " << st << " for " << i->getAircraft()->getCallSign());
SGPropertyNode_ptr trans_num = globals->get_props()->getNode("/sim/atc/transmission-num", true);
int n = trans_num->getIntValue();
if (n == 0) {
trans_num->setIntValue(-1);
// PopupCallback(n);
//cerr << "Selected transmission message " << n << endl;
SG_LOG(SG_ATC, SG_BULK, "Selected transmission message " << n);
FGATCDialogNew::instance()->removeEntry(1);
} else {
//cerr << "creading message for " << i->getAircraft()->getCallSign() << endl;
SG_LOG(SG_ATC, SG_BULK, "Creating message for " << i->getAircraft()->getCallSign());
transmit(&(*i), &(*parent), msgId, msgDir, false);
return false;
}
}
if (now > startTime) {
//cerr << "Transmitting startup msg" << endl;
SG_LOG(SG_ATC, SG_BULK, "Transmitting startup msg");
transmit(&(*i), &(*parent), msgId, msgDir, true);
i->updateState();
lastTransmission = now;
@ -1322,9 +1321,9 @@ void FGStartupController::updateAircraftInformation(int id, double lat, double l
time_t startTime = i->getAircraft()->getTrafficRef()->getDepartureTime();
time_t now = globals->get_time_params()->get_cur_time();
//cerr << i->getAircraft()->getTrafficRef()->getCallSign()
// << " is scheduled to depart in " << startTime-now << " seconds. Available = " << available
// << " at parking " << getGateName(i->getAircraft()) << endl;
SG_LOG(SG_ATC, SG_BULK, i->getAircraft()->getTrafficRef()->getCallSign()
<< " is scheduled to depart in " << startTime-now << " seconds. Available = " << available
<< " at parking " << getGateName(i->getAircraft()));
if ((now - lastTransmission) > 3 + (rand() % 15)) {
available = true;
@ -1381,13 +1380,13 @@ static void WorldCoordinate(osg::Matrix& obj_pos, double lat,
void FGStartupController::render(bool visible)
{
//std::cerr << "Rendering startup controller" << std::endl;
SG_LOG(SG_ATC, SG_DEBUG, "Rendering startup controller");
SGMaterialLib *matlib = globals->get_matlib();
if (group) {
//int nr = ;
globals->get_scenery()->get_scene_graph()->removeChild(group);
//while (group->getNumChildren()) {
// cerr << "Number of children: " << group->getNumChildren() << endl;
// SG_LOG(SG_ATC, SG_BULK, "Number of children: " << group->getNumChildren());
//simgear::EffectGeode* geode = (simgear::EffectGeode*) group->getChild(0);
//osg::MatrixTransform *obj_trans = (osg::MatrixTransform*) group->getChild(0);
//geode->releaseGLObjects();
@ -1411,7 +1410,7 @@ void FGStartupController::render(bool visible)
if (i->isActive(300)) {
// Handle start point
int pos = i->getCurrentPosition();
//cerr << "rendering for " << i->getAircraft()->getCallSign() << "pos = " << pos << endl;
SG_LOG(SG_ATC, SG_BULK, "rendering for " << i->getAircraft()->getCallSign() << "pos = " << pos);
if (pos > 0) {
FGTaxiSegment *segment = groundNet->findSegment(pos);
SGGeod start(SGGeod::fromDeg((i->getLongitude()), (i->getLatitude())));
@ -1425,7 +1424,7 @@ void FGStartupController::render(bool visible)
double coveredDistance = length * 0.5;
SGGeod center;
SGGeodesy::direct(start, heading, coveredDistance, center, az2);
//cerr << "Active Aircraft : Centerpoint = (" << center.getLatitudeDeg() << ", " << center.getLongitudeDeg() << "). Heading = " << heading << endl;
SG_LOG(SG_ATC, SG_BULK, "Active Aircraft : Centerpoint = (" << center.getLatitudeDeg() << ", " << center.getLongitudeDeg() << "). Heading = " << heading);
///////////////////////////////////////////////////////////////////////////////
// Make a helper function out of this
osg::Matrix obj_pos;
@ -1457,7 +1456,7 @@ void FGStartupController::render(bool visible)
double slope = atan2(elevDiff, length) * SGD_RADIANS_TO_DEGREES;
//cerr << "1. Using mean elevation : " << elevationMean << " and " << slope << endl;
SG_LOG(SG_ATC, SG_BULK, "1. Using mean elevation : " << elevationMean << " and " << slope);
WorldCoordinate( obj_pos, center.getLatitudeDeg(), center.getLongitudeDeg(), elevationMean + 0.5 + dx, -(heading), slope );
;
@ -1489,13 +1488,13 @@ void FGStartupController::render(bool visible)
group->addChild( obj_trans );
/////////////////////////////////////////////////////////////////////
} else {
//cerr << "BIG FAT WARNING: current position is here : " << pos << endl;
SG_LOG(SG_ATC, SG_DEBUG, "BIG FAT WARNING: current position is here : " << pos);
}
for (intVecIterator j = (i)->getIntentions().begin(); j != (i)->getIntentions().end(); j++) {
osg::Matrix obj_pos;
int k = (*j);
if (k > 0) {
//cerr << "rendering for " << i->getAircraft()->getCallSign() << "intention = " << k << endl;
SG_LOG(SG_ATC, SG_BULK, "rendering for " << i->getAircraft()->getCallSign() << "intention = " << k);
osg::MatrixTransform *obj_trans = new osg::MatrixTransform;
obj_trans->setDataVariance(osg::Object::STATIC);
FGTaxiSegment *segment = groundNet->findSegment(k);
@ -1532,7 +1531,7 @@ void FGStartupController::render(bool visible)
double length = segment->getLength();
double slope = atan2(elevDiff, length) * SGD_RADIANS_TO_DEGREES;
//cerr << "2. Using mean elevation : " << elevationMean << " and " << slope << endl;
SG_LOG(SG_ATC, SG_BULK, "2. Using mean elevation : " << elevationMean << " and " << slope);
SGGeod segCenter(segment->getCenter());
WorldCoordinate( obj_pos, segCenter.getLatitudeDeg(),
@ -1566,7 +1565,7 @@ void FGStartupController::render(bool visible)
//->addChild( obj_trans );
group->addChild( obj_trans );
} else {
//cerr << "BIG FAT WARNING: k is here : " << pos << endl;
SG_LOG(SG_ATC, SG_DEBUG, "BIG FAT WARNING: k is here : " << pos);
}
}
dx += 0.2;
@ -1664,7 +1663,7 @@ void FGApproachController::updateAircraftInformation(int id, double lat, double
} else {
i->setPositionAndHeading(lat, lon, heading, speed, alt);
current = i;
//cerr << "ApproachController: checking for speed" << endl;
SG_LOG(SG_ATC, SG_BULK, "ApproachController: checking for speed");
time_t time_diff =
current->getAircraft()->
checkForArrivalTime(string("final001"));
@ -1787,7 +1786,7 @@ ActiveRunway *FGApproachController::getRunway(const string& name)
}
void FGApproachController::render(bool visible) {
//std::cerr << "FGApproachController::render function not yet implemented" << std::endl;
SG_LOG(SG_ATC, SG_INFO, "FGApproachController::render function not yet implemented");
}

View file

@ -290,6 +290,16 @@ bool FGScheduledFlight::initializeAirports()
return true;
}
// Function to create a new instance of FGScheduledFlight for use with the ATC code
FGScheduledFlight* createScheduledFlightWithInfo(string departure, string destination, string FlightRules, string callsign){
FGScheduledFlight *flight = new FGScheduledFlight;
flight->setDepartureAirport(departure);
flight->setArrivalAirport(destination);
flight->initializeAirports();
flight->setFlightRules(FlightRules);
flight->setCallSign(callsign);
return flight;
}
bool compareScheduledFlights(FGScheduledFlight *a, FGScheduledFlight *b)
{

View file

@ -117,6 +117,8 @@ typedef std::vector<FGScheduledFlight*>::iterator FGScheduledFlightVecIterator;
typedef std::map < std::string, FGScheduledFlightVec > FGScheduledFlightMap;
FGScheduledFlight* createScheduledFlightWithInfo(string curAirport, string destination, string FlightRules, string callsign);
bool compareScheduledFlights(FGScheduledFlight *a, FGScheduledFlight *b);