struct AirportATC {
AirportATC();
- float lon;
- float lat;
- float elev;
+ SGGeod geod;
float atis_freq;
bool atis_active;
float tower_freq;
// Flags to ensure the stations don't get wrongly deactivated
bool set_by_AI; // true when the AI manager has activated this station
unsigned int numAI; // Ref count of the number of AI planes registered
- bool set_by_comm[2][ATC_NUM_TYPES]; // true when the relevant comm_freq has activated this station and type
+//xx bool set_by_comm[2][ATC_NUM_TYPES]; // true when the relevant comm_freq has activated this station and type
};
class FGATCMgr : public SGSubsystem
airport_atc_map_iterator airport_atc_map_itr;
// A list of pointers to all currently active ATC classes
- typedef list <FGATC*> atc_list_type;
+ typedef map<string,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_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;
-
- // Type of ATC control that the user's radios are tuned to.
- atc_type comm_type[2];
-
- // Pointer to the ATC station that the user is currently tuned into.
- FGATC* comm_atc_ptr[2];
-
- double comm_freq[2];
-
- // Pointers to users current communication frequencies.
- SGPropertyNode_ptr comm_node[2];
+ SGGeod _aircraftPos;
// Pointers to current users position
SGPropertyNode_ptr lon_node;
SGPropertyNode_ptr lat_node;
SGPropertyNode_ptr elev_node;
- // Position of the ATC that the comm radios are tuned to in order to decide
- // whether transmission will be received.
- double comm_x[2], comm_y[2], comm_z[2], comm_lon[2], comm_lat[2], comm_elev[2];
-
- double comm_range[2], comm_effective_range[2];
- bool comm_valid[2];
- string comm_ident[2];
- //string last_comm_ident[2];
//string approach_ident;
bool last_in_range;
// at different airports in quick succession if a large enough selection are available.
FGATCVoice* GetVoicePointer(const atc_type& type);
- atc_type GetComm1ATCType() { return(comm_type[0]); }
- FGATC* GetComm1ATCPointer() { return(comm_atc_ptr[0]); }
- atc_type GetComm2ATCType() { return(comm_type[1]); }
- FGATC* GetComm2ATCPointer() { return(comm_atc_ptr[1]); }
+ atc_type GetComm1ATCType() { return(INVALID/* kludge */); }
+ FGATC* GetComm1ATCPointer() { return(0/* kludge */); }
+ atc_type GetComm2ATCType() { return(INVALID); }
+ FGATC* GetComm2ATCPointer() { return(0/* kludge */); }
// Get the frequency of a given service at a given airport
// Returns zero if not found
// Remove a class from the atc_list and delete it from memory
// *if* no other comm channel or AI plane is using it.
- void CommRemoveFromList(const string& id, const atc_type& tp, int chan);
-
- // Remove a class from the atc_list and delete it from memory
- // Should be called from the above - not directly!!
- void RemoveFromList(const string& id, const atc_type& tp);
+ void ZapOtherService(const string ncunit, const string svc_name);
// Return a pointer to a class in the list given ICAO code and type
// (external interface to this is through GetATCPointer)
// - *** THE CALLING FUNCTION MUST CHECK FOR THIS ***
FGATC* FindInList(const string& id, const atc_type& tp);
- // Search the specified channel for stations on the same frequency and in range.
- void FreqSearch(int channel);
+ // Search the specified radio for stations on the same frequency and in range.
+ void FreqSearch(const string navcomm, const int unit);
- // Search ATC stations by area in order that we appear 'on the radar'
- void AreaSearch();
+#ifdef AREA_SEARCH
+ // Search ATC stations by area in order that we appear 'on the radar'
+ void AreaSearch();
+#endif
};