]> git.mxchange.org Git - flightgear.git/commitdiff
Better robustness for the ATCData structure istream operator. Adding fin.close(...
authordaveluff <daveluff>
Thu, 13 Feb 2003 12:17:37 +0000 (12:17 +0000)
committerdaveluff <daveluff>
Thu, 13 Feb 2003 12:17:37 +0000 (12:17 +0000)
src/ATC/commlist.cxx

index 17990558d52d7a46dbde39a9a5313037de940f3c..5494088a1d238c69f85405de160764130a5a432c 100644 (file)
@@ -86,23 +86,25 @@ bool FGCommList::LoadComms(SGPath path) {
         ATCData a;
                fin >> a;
                if(a.type == INVALID) {
-            break;
-        }
-               
-               // Push all stations onto frequency map
-        commlist_freq[a.freq].push_back(a);
-               
-               // Push approach stations onto bucket map as well
-               if(a.type == APPROACH) {
-                       // get bucket number
-               SGBucket bucket(a.lon, a.lat);
-               int bucknum = bucket.gen_index();
-                       commlist_bck[bucknum].push_back(a);
+                       cout << "WARNING - INVALID type found in " << path.str() << '\n';
+               } else {                
+                       // Push all stations onto frequency map
+                       commlist_freq[a.freq].push_back(a);
+                       
+                       // Push approach stations onto bucket map as well
+                       if(a.type == APPROACH) {
+                               // get bucket number
+                               SGBucket bucket(a.lon, a.lat);
+                               int bucknum = bucket.gen_index();
+                               commlist_bck[bucknum].push_back(a);
+                       }
                }
                
-        fin >> skipcomment;
-    }
-    return true;       
+               fin >> skipcomment;
+       }
+       
+       fin.close();
+       return true;    
 }