FGAIMgr::FGAIMgr() {
ATC = globals->get_ATC_mgr();
+ initDone = false;
}
FGAIMgr::~FGAIMgr() {
// See if are in range at startup and activate if necessary
SearchByPos(10.0);
+
+ initDone = true;
}
void FGAIMgr::bind() {
}
void FGAIMgr::update(double dt) {
+ if(!initDone) {
+ init();
+ SG_LOG(SG_ATC, SG_WARN, "Warning - AIMgr::update(...) called before AIMgr::init()");
+ }
+
static int i = 0;
static int j = 0;
private:
+ bool initDone; // Hack - guard against update getting called before init
+
// Remove a class from the ai_list and delete it from memory
//void RemoveFromList(const char* id, atc_type tp);
comm_type[1] = INVALID;
comm_atc_ptr[0] = NULL;
comm_atc_ptr[1] = NULL;
- comm_valid[0] = false;
- comm_valid[1] = false;
+ comm_valid[0] = false;
+ comm_valid[1] = false;
+
+ initDone = false;
}
FGATCMgr::~FGATCMgr() {
// DCL - testing
//current_atcdialog->add_entry( "EGNX", "Request vectoring for approach", "Request Vectors" );
//current_atcdialog->add_entry( "EGNX", "Mayday, Mayday", "Declare Emergency" );
+
+ initDone = true;
}
void FGATCMgr::update(double dt) {
+ if(!initDone) {
+ init();
+ SG_LOG(SG_ATC, SG_WARN, "Warning - ATCMgr::update(...) called before ATCMgr::init()");
+ }
+
//cout << "Entering update..." << endl;
//Traverse the list of active stations.
//Only update one class per update step to avoid the whole ATC system having to calculate between frames.
private:
+ bool initDone; // Hack - guard against update getting called before init
+
// A map of airport ID vs frequencies and ATC provision
typedef map < string, AirportATC* > airport_atc_map_type;
typedef airport_atc_map_type::iterator airport_atc_map_iterator;