1
0
Fork 0

Attached is a reasonably large patch to add a proper ATC

subsystem to Flightgear.  No more functionality is implemented
than at present (apart from an ATIS bug-fix - station wouldn't
change if the radio was switched directly from one station to
another) but it is much neater than the current hack and should be
easily extendable.

Some cruft is still probably left over in radiostack.[ch]xx such as
the bindings to the comm frequencies but I'll leave removing those
until I'm sure they're not needed there.
This commit is contained in:
curt 2002-03-01 17:39:52 +00:00
parent a6cb16ce36
commit 348ac42c90
16 changed files with 507 additions and 159 deletions

42
src/ATC/ATC.cxx Normal file
View file

@ -0,0 +1,42 @@
// Implementation of FGATC - ATC subsystem abstract base class.
// Nothing in here should ever get called.
//
// Written by David Luff, started February 2002.
//
// Copyright (C) 2002 David C Luff - david.luff@nottingham.ac.uk
//
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
#include "ATC.hxx"
FGATC::~FGATC() {
}
void FGATC::Update() {
}
void FGATC::SetDisplay() {
}
void FGATC::SetNoDisplay() {
}
const char* FGATC::GetIdent() {
return("Error - base class function called in FGATC...");
}
atc_type FGATC::GetType() {
return INVALID;
}

59
src/ATC/ATC.hxx Normal file
View file

@ -0,0 +1,59 @@
// FGATC - abstract base class for the various actual atc classes
// such as FGATIS, FGTower etc.
//
// Written by David Luff, started Feburary 2002.
//
// Copyright (C) 2002 David C. Luff - david.luff@nottingham.ac.uk
//
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef _FG_ATC_HXX
#define _FG_ATC_HXX
// Possible types of ATC type that the radios may be tuned to.
// INVALID implies not tuned in to anything.
typedef enum atc_type {
INVALID,
ATIS,
GROUND,
TOWER,
APPROACH,
DEPARTURE,
ENROUTE
};
class FGATC {
public:
virtual ~FGATC();
// Run the internal calculations
virtual void Update();
// Indicate that this instance should output to the display if appropriate
virtual void SetDisplay();
// Indicate that this instance should not output to the display
virtual void SetNoDisplay();
// Return the ATC station ident (generally the ICAO code of the airport)
virtual const char* GetIdent();
// Return the type of ATC station that the class represents
virtual atc_type GetType();
};
#endif // _FG_ATC_HXX

View file

@ -31,11 +31,8 @@
#include "ATCdisplay.hxx"
FGATCDisplay *current_atcdisplay;
// Constructor
FGATCDisplay::FGATCDisplay( void ) {
FGATCDisplay::FGATCDisplay() {
rep_msg = false;
change_msg_flag = false;
dsp_offset1 = 0;
@ -44,18 +41,23 @@ FGATCDisplay::FGATCDisplay( void ) {
// Destructor
FGATCDisplay::~FGATCDisplay( void ) {
FGATCDisplay::~FGATCDisplay() {
}
void FGATCDisplay::init( void ) {
void FGATCDisplay::init() {
}
void FGATCDisplay::bind() {
}
void FGATCDisplay::unbind() {
}
// update - this actually draws the visuals and should be called from the main Flightgear rendering loop.
void FGATCDisplay::update() {
void FGATCDisplay::update(int dt) {
// These strings are used for temporary storage of the transmission string in order
// that the string we view only changes when the next repitition starts scrolling
// that the string we view only changes when the next repetition starts scrolling
// even though the master string (rep_msg_str) may change at any time.
static string msg1 = "";
static string msg2 = "";

View file

@ -27,6 +27,8 @@
# include <config.h>
#endif
#include <Main/fgfs.hxx>
#include <vector>
#include <string>
@ -43,7 +45,8 @@ struct atcMessage {
typedef vector<atcMessage> atcMessageList;
typedef atcMessageList::iterator atcMessageListIterator;
class FGATCDisplay {
class FGATCDisplay : public FGSubsystem
{
private:
bool rep_msg; // Flag to indicate there is a repeating transmission to display
@ -60,13 +63,17 @@ public:
void init();
void bind();
void unbind();
// Display any registered messages
void update();
void update(int dt);
// Register a single message for display when possible
void RegisterSingleMessage(string msg); // OK - I know passing a string in and out is probably not good but it will have to do for now.
/* For now we will assume only one repeating message at once */
// For now we will assume only one repeating message at once
// This is not really robust
// Register a continuously repeating message
@ -79,6 +86,4 @@ public:
void CancelRepeatingMessage();
};
extern FGATCDisplay *current_atcdisplay;
#endif // _FG_ATC_DISPLAY_HXX

139
src/ATC/ATCmgr.cxx Normal file
View file

@ -0,0 +1,139 @@
// ATCmgr.cxx - Implementation of FGATCMgr - a global Flightgear ATC manager.
//
// Written by David Luff, started February 2002.
//
// Copyright (C) 2002 David C Luff - david.luff@nottingham.ac.uk
//
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
//#include <Time/event.hxx>
#include "ATCmgr.hxx"
#include "atislist.hxx"
/*
// periodic radio station search wrapper
static void fgATCSearch( void ) {
globals->get_ATC_mgr()->Search();
}
*/ //This wouldn't compile - including Time/event.hxx breaks it :-(
FGATCMgr::FGATCMgr() {
}
FGATCMgr::~FGATCMgr() {
}
void FGATCMgr::bind() {
}
void FGATCMgr::unbind() {
}
void FGATCMgr::init() {
comm1_node = fgGetNode("/radios/comm[0]/frequencies/selected-mhz", true);
comm2_node = fgGetNode("/radios/comm[1]/frequencies/selected-mhz", true);
lon_node = fgGetNode("/position/longitude-deg", true);
lat_node = fgGetNode("/position/latitude-deg", true);
elev_node = fgGetNode("/position/altitude-ft", true);
atc_list_itr = atc_list.begin();
// Search for connected ATC stations once per 0.8 seconds or so
// global_events.Register( "fgATCSearch()", fgATCSearch,
// fgEVENT::FG_EVENT_READY, 800);
// For some reason the above doesn't compile - including Time/event.hxx stops compilation.
}
void FGATCMgr::update(int dt) {
//Traverse the list of active stations.
//Only update one class per update step to avoid the whole ATC system having to calculate between frames.
//Eventually we should only update every so many steps.
if(atc_list.size()) {
if(atc_list_itr == atc_list.end()) {
atc_list_itr = atc_list.begin();
}
(*atc_list_itr)->Update();
++atc_list_itr;
}
// Search the tuned frequencies every now and then - this should be done with the event scheduler
static int i = 0;
if(i == 30) {
Search();
i = 0;
}
++i;
}
void FGATCMgr::RemoveFromList(const char* id, atc_type tp) {
atc_list_itr = atc_list.begin();
while(atc_list_itr != atc_list.end()) {
if( (!strcmp((*atc_list_itr)->GetIdent(), id))
&& ((*atc_list_itr)->GetType() == tp) ) {
//Before removing it stop it transmitting!!
(*atc_list_itr)->SetNoDisplay();
(*atc_list_itr)->Update();
delete (*atc_list_itr);
atc_list_itr = atc_list.erase(atc_list_itr);
break;
} // Note that that can upset where we are in the list but that doesn't really matter
++atc_list_itr;
}
}
void FGATCMgr::Search() {
////////////////////////////////////////////////////////////////////////
// Comm1.
////////////////////////////////////////////////////////////////////////
comm1_freq = comm1_node->getDoubleValue();
double lon = lon_node->getDoubleValue() * SGD_DEGREES_TO_RADIANS;
double lat = lat_node->getDoubleValue() * SGD_DEGREES_TO_RADIANS;
double elev = elev_node->getDoubleValue() * SG_FEET_TO_METER;
//Search for ATIS first
if(current_atislist->query(lon, lat, elev, comm1_freq, &atis)) {
//cout << "atis found in radiostack search !!!!" << endl;
comm1_ident = atis.GetIdent();
comm1_valid = true;
if(last_comm1_ident != comm1_ident) {
if(last_comm1_ident != "") {
RemoveFromList(last_comm1_ident, ATIS);
}
last_comm1_ident = comm1_ident;
comm1_elev = atis.get_elev();
comm1_range = FG_ATIS_DEFAULT_RANGE;
comm1_effective_range = comm1_range;
comm1_x = atis.get_x();
comm1_y = atis.get_y();
comm1_z = atis.get_z();
FGATIS* a = new FGATIS;
*a = atis;
a->SetDisplay();
atc_list.push_back(a);
//cout << "Found a new atis station in range" << endl;
//cout << " id = " << atis.GetIdent() << endl;
}
} else {
if(comm1_valid) {
RemoveFromList(comm1_ident, ATIS);
comm1_valid = false;
comm1_ident = "";
//comm1_trans_ident = "";
last_comm1_ident = "";
}
//cout << "not picking up atis" << endl;
}
}

115
src/ATC/ATCmgr.hxx Normal file
View file

@ -0,0 +1,115 @@
// ATCMgr.hxx - definition of FGATCMgr
// - a global management class for FlightGear generated ATC
//
// Written by David Luff, started February 2002.
//
// Copyright (C) 2002 David C Luff - david.luff@nottingham.ac.uk
//
// 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., 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef _FG_ATCMGR_HXX
#define _FG_ATCMGR_HXX
#include <Main/fgfs.hxx>
#include <Main/fg_props.hxx>
#include <list>
#include "atis.hxx"
#include "ATC.hxx"
SG_USING_STD(list);
class FGATCMgr : public FGSubsystem
{
private:
// A list of pointers to all currently active ATC classes
typedef list <FGATC*> atc_list_type;
typedef atc_list_type::iterator atc_list_iterator;
typedef atc_list_type::const_iterator atc_list_const_iterator;
// Everything put in this list should be created dynamically
// on the heap and ***DELETED WHEN REMOVED!!!!!***
atc_list_type atc_list;
atc_list_iterator atc_list_itr;
// Any member function of FGATCMgr is permitted to leave this iterator pointing
// at any point in or at the end of the list.
// Hence any new access must explicitly first check for atc_list.end() before dereferencing.
// Position of the Users Aircraft
double lon;
double lat;
double elev;
atc_type comm1_type;
atc_type comm2_type;
double comm1_freq;
double comm2_freq;
// Pointers to users current communication frequencies.
SGPropertyNode *comm1_node;
SGPropertyNode *comm2_node;
// Pointers to current users position
SGPropertyNode *lon_node;
SGPropertyNode *lat_node;
SGPropertyNode *elev_node;
// Position of the ATC that the comm radios are tuned to in order to decide whether transmission
// will be received
double comm1_x, comm1_y, comm1_z, comm1_elev;
double comm1_range, comm1_effective_range;
bool comm1_valid;
const char* comm1_ident;
const char* last_comm1_ident;
double comm2_x, comm2_y, comm2_z, comm2_elev;
double comm2_range, comm2_effective_range;
bool comm2_valid;
const char* comm2_ident;
const char* last_comm2_ident;
FGATIS atis;
//FGTower tower;
//FGGround ground;
//FGApproach approach;
//FGDeparture departure;
public:
FGATCMgr();
~FGATCMgr();
void init();
void bind();
void unbind();
void update(int dt);
private:
// Remove a class from the atc_list and delete it from memory
void RemoveFromList(const char* id, atc_type tp);
// Search a specified freq for matching stations
void Search();
};
#endif // _FG_ATCMGR_HXX

View file

@ -1,8 +1,11 @@
noinst_LIBRARIES = libATC.a
libATC_a_SOURCES = \
atis.cxx atis.hxx atislist.hxx atislist.cxx \
ATCdisplay.hxx ATCdisplay.cxx
ATC.hxx ATC.cxx \
ATCdisplay.hxx ATCdisplay.cxx \
ATCmgr.hxx ATCmgr.cxx \
atis.cxx atis.hxx \
atislist.hxx atislist.cxx
if OLD_AUTOMAKE
INCLUDES += -I$(top_srcdir) -I$(top_srcdir)/src

View file

@ -1,4 +1,5 @@
// atis.cxx - routines to generate the ATIS info string
// This is the implementation of the FGATIS class
//
// Written by David Luff, started October 2001.
//
@ -47,10 +48,12 @@ SG_USING_STD(cout);
//#endif
#include <Main/fg_props.hxx>
#include <Main/globals.hxx>
#include <Airports/runways.hxx>
#include "atis.hxx"
#include "atislist.hxx"
#include "ATCdisplay.hxx"
string GetPhoneticIdent(int i) {
// TODO - Check i is between 1 and 26 and wrap if necessary
@ -88,17 +91,40 @@ string GetPhoneticIdent(int i) {
// Constructor
FGATIS::FGATIS() {
transmission = "";
display = false;
displaying = false;
}
// Destructor
FGATIS::~FGATIS() {
}
string FGATIS::get_transmission() {
//void FGATIS::get_transmission() {
#if !defined(FG_NEW_ENVIRONMENT)
// Main update function - checks whether we are displaying or not the correct message.
void FGATIS::Update() {
if(display) {
if(displaying) {
// Check if we need to update the message
// - basically every hour and if the weather changes significantly at the station
//globals->get_ATC_display()->ChangeRepeatingMessage(transmission);
} else {
// We need to get and display the message
UpdateTransmission();
globals->get_ATC_display()->RegisterRepeatingMessage(transmission);
displaying = true;
}
} else {
// We shouldn't be displaying
if(displaying) {
globals->get_ATC_display()->CancelRepeatingMessage();
displaying = false;
}
}
}
string transmission = "";
// Sets the actual broadcast ATIS transmission.
void FGATIS::UpdateTransmission() {
#if !defined(FG_NEW_ENVIRONMENT)
double visibility;
char buf[10];
int phonetic_id;
@ -109,12 +135,6 @@ string FGATIS::get_transmission() {
sgVec3 position = { lat, lon, elev };
FGPhysicalProperty stationweather = WeatherDatabase->get(position);
// Only update every so-many loops - FIXME - possibly register this with the event scheduler
// Ack this doesn't work since the static counter is shared between all instances of FGATIS
// OK, for now the radiostack is handling only calling this every-so-often but that is not really
// a proper solution since the atis knows when the transmission is going to change not the radio.
//static int i=0;
//if(i == 0) {
transmission = "";
// Start with the transmitted station name.
@ -207,19 +227,11 @@ string FGATIS::get_transmission() {
// Anything else?
// TODO - unhardwire the identifier
transmission += " Advise controller on initial contact you have ";
transmission += phonetic_id_string;
//}
// i++;
// if(i == 600) {
// i=0;
// }
return(transmission);
#else
return "Station unavailable (not supported by FG_NEW_ENVIRONMENT)";
transmission = "Station unavailable (not supported by FG_NEW_ENVIRONMENT)";
//return "Station unavailable (not supported by FG_NEW_ENVIRONMENT)";
#endif // FG_NEW_ENVIRONMENT
}

View file

@ -1,8 +1,9 @@
// atis.hxx -- ATIS class
//
// Written by Curtis Olson, started April 2000.
// Written by David Luff, started October 2001.
// Based on nav.hxx by Curtis Olson, started April 2000.
//
// Copyright (C) 2000 Curtis L. Olson - curt@flightgear.org
// Copyright (C) 2001 David C. Luff - david.luff@nottingham.ac.uk
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
@ -50,10 +51,12 @@ SG_USING_STD(istream);
SG_USING_STD(string);
#include "ATC.hxx"
//DCL - a complete guess for now.
#define FG_ATIS_DEFAULT_RANGE 30
class FGATIS {
class FGATIS : public FGATC {
char type;
double lon, lat;
@ -61,9 +64,11 @@ class FGATIS {
double x, y, z;
int freq;
int range;
bool display; // Flag to indicate whether we should be outputting to the ATC display.
bool displaying; // Flag to indicate whether we are outputting to the ATC display.
string ident; // Code of the airport its at.
string name; // Name transmitted in the broadcast.
string info; // The actual ATIS transmission
string transmission; // The actual ATIS transmission
// This is not stored in default.atis but is generated
// from the prevailing conditions when required.
@ -71,11 +76,29 @@ class FGATIS {
string trans_ident; // transmitted ident
bool atis_failed; // atis failed?
// Aircraft position
// ATIS is actually a special case in that unlike other ATC eg.tower it doesn't actually know about
// or the whereabouts of the aircraft it is transmitting to. However, to ensure consistancy of
// operation with the other ATC classes the ATIS class must calculate range to the aircraft in order
// to decide whether to render the transmission - hence the users plane details must be stored.
//SGPropertyNode *airplane_lon_node;
//SGPropertyNode *airplane_lat_node;
//SGPropertyNode *airplane_elev_node;
public:
FGATIS(void);
~FGATIS(void);
//run the ATIS instance
void Update(void);
//Indicate that this instance should be outputting to the ATC display
inline void SetDisplay(void) {display = true;}
//Indicate that this instance should not be outputting to the ATC display
inline void SetNoDisplay(void) {display = false;}
inline char get_type() const { return type; }
inline double get_lon() const { return lon; }
inline double get_lat() const { return lat; }
@ -85,10 +108,14 @@ public:
inline double get_z() const { return z; }
inline int get_freq() const { return freq; }
inline int get_range() const { return range; }
inline const char *get_ident() { return ident.c_str(); }
inline const char* GetIdent() { return ident.c_str(); }
inline string get_trans_ident() { return trans_ident; }
string get_transmission(void);
// void get_transmission();
inline atc_type GetType() { return ATIS; }
private:
//Update the transmission string
void UpdateTransmission(void);
/* inline void set_type( char t ) { type = t; }
inline void set_lon( double l ) { lon = l; }

View file

@ -1,6 +1,7 @@
// atislist.cxx -- navaids management class
//
// Written by Curtis Olson, started April 2000.
// Written by David Luff, started October 2001.
// Based on navlist.cxx by Curtis Olson, started April 2000.
//
// Copyright (C) 2000 Curtis L. Olson - curt@flightgear.org
//

View file

@ -1,6 +1,7 @@
// atislist.hxx -- atis management class
//
// Written by Curtis Olson, started April 2000.
// Written by David Luff, started October 2001.
// Based on navlist.hxx by Curtis Olson, started April 2000.
//
// Copyright (C) 2000 Curtis L. Olson - curt@flightgear.org
//

View file

@ -31,8 +31,6 @@
#include <simgear/math/sg_random.h>
#include <Aircraft/aircraft.hxx>
#include <ATC/ATCdisplay.hxx>
//#include <Navaids/atis.hxx>
#include <Navaids/ilslist.hxx>
#include <Navaids/mkrbeacons.hxx>
#include <Navaids/navlist.hxx>
@ -404,9 +402,6 @@ double FGRadioStack::adjustILSRange( double stationElev, double aircraftElev,
void
FGRadioStack::update(int dt)
{
//DCL
string transmission;
double lon = lon_node->getDoubleValue() * SGD_DEGREES_TO_RADIANS;
double lat = lat_node->getDoubleValue() * SGD_DEGREES_TO_RADIANS;
double elev = alt_node->getDoubleValue() * SG_FEET_TO_METER;
@ -417,48 +412,6 @@ FGRadioStack::update(int dt)
Point3D station;
double az1, az2, s;
////////////////////////////////////////////////////////////////////////
// Comm1.
////////////////////////////////////////////////////////////////////////
static bool repeating_message_registered = false;
static int dcl_i = 0; //Hack to only call the transmission now and then - should use the event scheduler
if ( comm1_valid ) {
station = Point3D( comm1_x, comm1_y, comm1_z );
comm1_dist = aircraft.distance3D( station );
if ( comm1_dist < comm1_effective_range * SG_NM_TO_METER ) {
comm1_inrange = true;
// TODO - only get the transmission and register every now and then
if(dcl_i == 0) {
transmission = atis.get_transmission();
current_atcdisplay->ChangeRepeatingMessage(transmission);
}
if(!repeating_message_registered) {
current_atcdisplay->RegisterRepeatingMessage(transmission);
repeating_message_registered = true;
}
dcl_i++;
if(dcl_i == 2000) {
dcl_i = 0;
}
} else {
comm1_inrange = false;
if(repeating_message_registered) {
current_atcdisplay->CancelRepeatingMessage();
repeating_message_registered = false;
}
dcl_i = 0;
}
} else {
comm1_inrange = false;
if(repeating_message_registered) {
current_atcdisplay->CancelRepeatingMessage();
repeating_message_registered = false;
}
dcl_i = 0;
// cout << "not picking up comm1. :-(" << endl;
}
////////////////////////////////////////////////////////////////////////
// Nav1.
////////////////////////////////////////////////////////////////////////
@ -812,43 +765,12 @@ void FGRadioStack::search()
FGILS ils;
FGNav nav;
static string last_comm1_ident = "";
static string last_comm2_ident = "";
static string last_nav1_ident = "";
static string last_nav2_ident = "";
static string last_adf_ident = "";
static bool last_nav1_vor = false;
static bool last_nav2_vor = false;
////////////////////////////////////////////////////////////////////////
// Comm1.
////////////////////////////////////////////////////////////////////////
if ( current_atislist->query( lon, lat, elev, comm1_freq, &atis ) ) {
//cout << "atis found in radiostack search !!!!" << endl;
comm1_ident = atis.get_ident();
comm1_valid = true;
if ( last_comm1_ident != comm1_ident ) {
//nav1_trans_ident = ils.get_trans_ident();
last_comm1_ident = comm1_ident;
comm1_elev = atis.get_elev();
comm1_range = FG_ATIS_DEFAULT_RANGE;
comm1_effective_range = comm1_range;
comm1_x = atis.get_x();
comm1_y = atis.get_y();
comm1_z = atis.get_z();
//cout << "Found a new atis station in range" << endl;
//cout << " id = " << atis.get_ident() << endl;
}
} else {
comm1_valid = false;
comm1_ident = "";
//comm1_trans_ident = "";
last_comm1_ident = "";
// cout << "not picking up atis" << endl;
}
////////////////////////////////////////////////////////////////////////
// Nav1.
////////////////////////////////////////////////////////////////////////
@ -1422,4 +1344,3 @@ FGRadioStack::get_nav2_from_flag () const
return false;
}
}

View file

@ -35,7 +35,6 @@
#include <Navaids/ilslist.hxx>
#include <Navaids/navlist.hxx>
#include <ATC/atislist.hxx>
#include <Sound/beacon.hxx>
#include <Sound/morse.hxx>
@ -55,8 +54,6 @@ class FGRadioStack : public FGSubsystem
bool need_update;
FGATIS atis;
string comm1_ident;
bool comm1_valid;
bool comm1_inrange;

View file

@ -70,6 +70,8 @@
#include <Airports/runways.hxx>
#include <Airports/simple.hxx>
#include <ATC/ATCdisplay.hxx>
#include <ATC/ATCmgr.hxx>
#include <ATC/atislist.hxx>
#include <Autopilot/auto_gui.hxx>
#include <Autopilot/newauto.hxx>
#include <Cockpit/cockpit.hxx>
@ -866,7 +868,6 @@ bool fgInitSubsystems( void ) {
// Initialize ATC list management and query systems
////////////////////////////////////////////////////////////////////
//DCL
SG_LOG(SG_GENERAL, SG_INFO, " ATIS");
current_atislist = new FGATISList;
SGPath p_atis( globals->get_fg_root() );
@ -877,10 +878,17 @@ bool fgInitSubsystems( void ) {
// Initialise ATC display system
////////////////////////////////////////////////////////////////////
//DCL
SG_LOG(SG_GENERAL, SG_INFO, " ATC Display");
current_atcdisplay = new FGATCDisplay;
current_atcdisplay->init();
globals->set_ATC_display(new FGATCDisplay);
globals->get_ATC_display()->init();
////////////////////////////////////////////////////////////////////
// Initialise the ATC Manager
////////////////////////////////////////////////////////////////////
SG_LOG(SG_GENERAL, SG_INFO, " ATC Manager");
globals->set_ATC_mgr(new FGATCMgr);
globals->get_ATC_mgr()->init();
////////////////////////////////////////////////////////////////////
// Initialize the built-in commands.

View file

@ -51,6 +51,8 @@ class FGSoundMgr;
class FGFX;
class FGViewMgr;
class FGViewer;
class FGATCMgr;
class FGATCDisplay;
class FGGlobals {
@ -101,6 +103,12 @@ private:
// environment information
FGEnvironmentMgr * environment_mgr;
// ATC manager
FGATCMgr *ATC_mgr;
// ATC Renderer
FGATCDisplay *ATC_display;
// control input state
FGControls *controls;
@ -170,6 +178,12 @@ public:
const FGEnvironment * get_environment(double lat, double lon,
double alt) const;
inline FGATCMgr *get_ATC_mgr() const { return ATC_mgr; }
inline void set_ATC_mgr( FGATCMgr *a ) {ATC_mgr = a; }
inline FGATCDisplay *get_ATC_display() const { return ATC_display; }
inline void set_ATC_display( FGATCDisplay *d ) {ATC_display = d; }
inline FGSoundMgr *get_soundmgr() const { return soundmgr; }
inline void set_soundmgr( FGSoundMgr *sm ) { soundmgr = sm; }
@ -215,5 +229,3 @@ extern FGGlobals *globals;
#endif // _GLOBALS_HXX

View file

@ -77,6 +77,7 @@
#include <Aircraft/aircraft.hxx>
#include <ATC/ATCmgr.hxx>
#include <ATC/ATCdisplay.hxx>
#include <Autopilot/newauto.hxx>
@ -793,7 +794,7 @@ void fgRenderFrame( void ) {
// Use the hud_and_panel ssgSimpleState for rendering the ATC output
// This only works properly if called before the panel call
current_atcdisplay->update();
globals->get_ATC_display()->update(1); // FIXME: use real dt
// update the panel subsystem
if ( current_panel != NULL ) {
@ -1094,6 +1095,9 @@ static void fgMainLoop( void ) {
++frames;
#endif
// Run ATC subsystem
globals->get_ATC_mgr()->update(1); // FIXME: use real dt
// Run flight model
// Calculate model iterations needed for next frame