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
This commit is contained in:
parent
f57e495893
commit
b271bc5da2
1 changed files with 17 additions and 15 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue