]> git.mxchange.org Git - flightgear.git/blobdiff - src/ATC/ATC.cxx
Fix the nmea and garmin output to a) fake a GSA sentence, b) fix a y2k bug
[flightgear.git] / src / ATC / ATC.cxx
index 120c00e98d50f444b7d9933b9227e1982544bd48..7adb85c4f7d97b00d45f5cd005858ae6d9ba14f4 100644 (file)
 
 FGATC::FGATC() {
        freqClear = true;
+       receiving = false;
+       respond = false;
+       runResponseCounter = false;
+       responseID = "";
+       responseReqd = false;
 }
 
 FGATC::~FGATC() {
 }
 
+// Derived classes wishing to use the response counter should call this from their own Update(...).
 void FGATC::Update(double dt) {
+       if(runResponseCounter) {
+               //cout << responseCounter << '\t' << responseTime << '\n';
+               if(responseCounter >= responseTime) {
+                       runResponseCounter = false;
+                       respond = true;
+                       //cout << "RESPOND\n";
+               } else {
+                       responseCounter += dt;
+               }
+       }
+}
+
+void FGATC::ReceiveUserCallback(int code) {
+       SG_LOG(SG_ATC, SG_WARN, "WARNING - whichever ATC class was intended to receive callback code " << code << " didn't get it!!!");
+}
+
+void FGATC::SetResponseReqd(string rid) {
+       receiving = false;
+       responseReqd = true;
+       respond = false;        // TODO - this ignores the fact that more than one plane could call this before response
+                                               // Shouldn't happen with AI only, but user could confuse things??
+       responseID = rid;
+       runResponseCounter = true;
+       responseCounter = 0.0;
+       responseTime = 1.8;             // TODO - randomize this slightly.
+}
+
+void FGATC::NotifyTransmissionFinished(string rid) {
+       receiving = false;
+       responseID = rid;
+       if(responseReqd) {
+               runResponseCounter = true;
+               responseCounter = 0.0;
+               responseTime = 1.8;             // TODO - randomize this slightly.
+       } else {
+               freqClear = true;
+       }
 }
 
 void FGATC::AddPlane(string pid) {
@@ -123,6 +166,11 @@ void FGATC::NoRender(string refname) {
        }
 }
 
+// Generate the text of a message from its parameters and the current context.
+string FGATC::GenText(const string& m, int c) {
+       return("");
+}
+
 ostream& operator << (ostream& os, atc_type atc) {
        switch(atc) {
                case(INVALID):    return(os << "INVALID");