From b271bc5da23a3f2fde03930a19fed026ccac4dd7 Mon Sep 17 00:00:00 2001 From: daveluff Date: Thu, 13 Feb 2003 12:17:37 +0000 Subject: [PATCH] Better robustness for the ATCData structure istream operator. Adding fin.close() seems to have cured an intermittent stackdump when reading in the voice files which are the next istream operation to occur. Unknown types no longer cause the rest of the file not to be read - only the specific unknown entry --- src/ATC/commlist.cxx | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/ATC/commlist.cxx b/src/ATC/commlist.cxx index 17990558d..5494088a1 100644 --- a/src/ATC/commlist.cxx +++ b/src/ATC/commlist.cxx @@ -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; } -- 2.39.5