SG_USING_STD(map);
// Structure for holding details of the ATC frequencies at a given airport, and whether they are in the active list or not.
-// These can then be cross referenced with the [atis][tower][etc]lists which are stored by frequency.
+// These can then be cross referenced with the commlists which are stored by frequency or bucket.
// Non-available services are denoted by a frequency of zero.
-// Eventually the whole ATC data structures may have to be rethought if we turn out to be massive memory hogs!!
+// These structures are only intended to be created for in-use airports, and removed when no longer needed.
struct AirportATC {
+ AirportATC();
+
float lon;
float lat;
float elev;
//bool approach_active;
//float departure_freq;
//bool departure_active;
+
+ // NOTE - the *_active flags determine whether the service is active in atc_list,
+ // *NOT* whether the tower etc is closed or not!!!!
// Flags to ensure the stations don't get wrongly deactivated
bool set_by_AI; // true when the AI manager has activated this station
- bool set_by_comm_search; // true when the comm_search has activated this station
+ unsigned int numAI; // Ref count of the number of AI planes registered
+ bool set_by_comm[2]; // true when the relevant comm_freq has activated this station
};
class FGATCMgr : public FGSubsystem
bool GetAirportATCDetails(string icao, AirportATC* a);
// Return a pointer to a given sort of ATC at a given airport and activate if necessary
+ // Returns NULL if service doesn't exist - calling function should check for this.
FGATC* GetATCPointer(string icao, atc_type type);
// Display a dialog box with options relevant to the currently tuned ATC service.
atc_type GetComm2ATCType() { return(comm_type[1]); }
FGATC* GetComm2ATCPointer() { return(comm_atc_ptr[1]); }
+ // Get the frequency of a given service at a given airport
+ // Returns zero if not found
+ unsigned short int GetFrequency(string ident, atc_type tp);
+
+ // Register the fact that the AI system wants to activate an airport
+ bool AIRegisterAirport(string ident);
+
+ // Register the fact that the comm radio is tuned to an airport
+ bool CommRegisterAirport(string ident, int chan);
+
private:
// Remove a class from the atc_list and delete it from memory