]> git.mxchange.org Git - flightgear.git/blobdiff - src/ATC/ground.cxx
Get rid of the double comma's for the file section of the generic protocol also.
[flightgear.git] / src / ATC / ground.cxx
index a6dc207905b9363c8ccd565588c81e38b1510128..3e2e0f68b95268f04942e872575189f7d27bf943 100644 (file)
@@ -53,7 +53,7 @@ a_path::a_path() {
 
 FGGround::FGGround() {
        ATCmgr = globals->get_ATC_mgr();
-       display = false;
+       _type = GROUND;
        networkLoadOK = false;
        ground_traffic.erase(ground_traffic.begin(), ground_traffic.end());
        ground_traffic_itr = ground_traffic.begin();
@@ -68,7 +68,6 @@ FGGround::FGGround() {
 
 FGGround::FGGround(string id) {
        ATCmgr = globals->get_ATC_mgr();
-       display = false;
        networkLoadOK = false;
        ground_traffic.erase(ground_traffic.begin(), ground_traffic.end());
        ground_traffic_itr = ground_traffic.begin();
@@ -273,7 +272,6 @@ bool FGGround::LoadNetwork() {
 }
 
 void FGGround::Init() {
-       display = false;
        untowered = false;
        
        // Figure out which is the active runway - TODO - it would be better to have ground call tower
@@ -317,7 +315,7 @@ void FGGround::Update(double dt) {
                                trns += " taxi holding point runway ";  // TODO - add the holding point name
                                // eg " taxi holding point G2 runway "
                                trns += ConvertRwyNumToSpokenString(activeRwy);
-                               if(display) {
+                               if(_display) {
                                        globals->get_ATC_display()->RegisterSingleMessage(trns, 0);
                                }
                                g->planePtr->RegisterTransmission(1);   // cleared to taxi
@@ -331,11 +329,11 @@ void FGGround::Update(double dt) {
                        // NOTE - we don't need to do the contact tower bit unless we have separate tower and ground
                        string trns = g->plane.callsign;
                        trns += " contact Tower ";
-                       double f = globals->get_ATC_mgr()->GetFrequency(ident, TOWER);
+                       double f = globals->get_ATC_mgr()->GetFrequency(ident, TOWER) / 100.0;
                        char buf[10];
-                       sprintf(buf, "%f", f);
+                       sprintf(buf, "%.2f", f);
                        trns += buf;
-                       if(display) {
+                       if(_display) {
                                globals->get_ATC_display()->RegisterSingleMessage(trns, 0);
                        }
                        g->planePtr->RegisterTransmission(2);   // contact tower
@@ -345,6 +343,9 @@ void FGGround::Update(double dt) {
                }                               
                ++ground_traffic_itr;
        }
+       
+       // Call the base class update for the response time handling.
+       FGATC::Update(dt);
 }
 
 // Figure out which runways are active.
@@ -356,10 +357,6 @@ void FGGround::DoRwyDetails() {
        //cout << "GetRwyDetails called" << endl;
        
        // Based on the airport-id and wind get the active runway
-       SGPath path( globals->get_fg_root() );
-       path.append( "Airports" );
-       path.append( "runways.mk4" );
-       FGRunways r_ways( path.c_str() );
        
        //wind
        double hdg = wind_from_hdg->getDoubleValue();
@@ -368,7 +365,7 @@ void FGGround::DoRwyDetails() {
        //cout << "Heading = " << hdg << '\n';
        
        FGRunway runway;
-       bool rwyGood = r_ways.search(ident, int(hdg), &runway);
+       bool rwyGood = globals->get_runways()->search(ident, int(hdg), &runway);
        if(rwyGood) {
                activeRwy = runway.rwy_no;
                rwy.rwyID = runway.rwy_no;
@@ -455,6 +452,11 @@ Gate* FGGround::GetGateNode() {
 }
 
 
+node* FGGround::GetHoldShortNode(string rwyID) {
+       return(NULL);   // TODO - either implement me or remove me!!!
+}
+
+
 // WARNING - This is hardwired to my prototype logical network format
 // and will almost certainly change when Bernie's stuff comes on-line.
 // Returns NULL if it can't find a valid node.
@@ -496,7 +498,7 @@ ground_network_path_type FGGround::GetPath(node* A, node* B) {
 ground_network_path_type FGGround::GetPath(node* A, string rwyID) {
        node* b = GetThresholdNode(rwyID);
        if(b == NULL) {
-               SG_LOG(SG_ATC, SG_ALERT, "ERROR - unable to find path to runway theshold in ground.cxx\n");
+               SG_LOG(SG_ATC, SG_ALERT, "ERROR - unable to find path to runway theshold in ground.cxx for airport " << ident << '\n');
                ground_network_path_type emptyPath;
                emptyPath.erase(emptyPath.begin(), emptyPath.end());
                return(emptyPath);