Remove some extraneous output, add a few comments, tidy a bit of formatting
This commit is contained in:
parent
a28bf4d9ea
commit
81c252e40e
3 changed files with 25 additions and 18 deletions
|
@ -79,10 +79,10 @@ struct TransPar {
|
||||||
// FGTransmission - a class to encapsulate a speech transmission
|
// FGTransmission - a class to encapsulate a speech transmission
|
||||||
class FGTransmission {
|
class FGTransmission {
|
||||||
|
|
||||||
int StationType; // Type of ATC station: 1 Approach
|
int StationType; // Type of ATC station: 1 Approach
|
||||||
TransCode Code;
|
TransCode Code; // DCL - no idea what this is.
|
||||||
string TransText;
|
string TransText; // The text of the spoken transmission
|
||||||
string MenuText;
|
string MenuText; // An abbreviated version of the text for the menu entry
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
|
@ -89,21 +89,24 @@ bool FGTransmissionList::init( SGPath path ) {
|
||||||
|
|
||||||
while ( ! in.eof() ) {
|
while ( ! in.eof() ) {
|
||||||
in >> a;
|
in >> a;
|
||||||
transmissionlist_station[a.get_station()].push_back(a);
|
transmissionlist_station[a.get_station()].push_back(a);
|
||||||
|
|
||||||
in >> skipcomment;
|
in >> skipcomment;
|
||||||
|
|
||||||
if ( a.get_station() < min ) {
|
if ( a.get_station() < min ) {
|
||||||
min = a.get_station();
|
min = a.get_station();
|
||||||
}
|
}
|
||||||
if ( a.get_station() > max ) {
|
if ( a.get_station() > max ) {
|
||||||
max = a.get_station();
|
max = a.get_station();
|
||||||
}
|
}
|
||||||
cout << a.get_station() << " " << a.get_code().c1 << " " << a.get_code().c2 << " "
|
|
||||||
<< a.get_code().c3 << " " << a.get_transtext()
|
/*
|
||||||
<< " " << a.get_menutext() << endl;
|
cout << a.get_station() << " " << a.get_code().c1 << " " << a.get_code().c2 << " "
|
||||||
|
<< a.get_code().c3 << " " << a.get_transtext()
|
||||||
|
<< " " << a.get_menutext() << endl;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// init ATC menu
|
// init ATC menu
|
||||||
|
@ -161,14 +164,15 @@ string FGTransmissionList::gen_text(const int &station, const TransCode code,
|
||||||
for ( ; current != last ; ++current ) {
|
for ( ; current != last ; ++current ) {
|
||||||
if ( current->get_code().c1 == code.c1 &&
|
if ( current->get_code().c1 == code.c1 &&
|
||||||
current->get_code().c2 == code.c2 &&
|
current->get_code().c2 == code.c2 &&
|
||||||
current->get_code().c3 == code.c3 ) {
|
current->get_code().c3 == code.c3 ) {
|
||||||
|
|
||||||
if ( ttext ) message = current->get_transtext();
|
if ( ttext ) message = current->get_transtext();
|
||||||
else message = current->get_menutext();
|
else message = current->get_menutext();
|
||||||
strcpy( &mes[0], message.c_str() );
|
strcpy( &mes[0], message.c_str() );
|
||||||
|
|
||||||
|
// Replace all the '@' parameters with the actual text.
|
||||||
int check = 0; // If mes gets overflowed the while loop can go infinite
|
int check = 0; // If mes gets overflowed the while loop can go infinite
|
||||||
while ( strchr(&mes[0], crej) != NULL ) {
|
while ( strchr(&mes[0], crej) != NULL ) { // ie. loop until no more occurances of crej ('@') found
|
||||||
pos = strchr( &mes[0], crej );
|
pos = strchr( &mes[0], crej );
|
||||||
bcopy(pos, &tag[0], 3);
|
bcopy(pos, &tag[0], 3);
|
||||||
tag[3] = '\0';
|
tag[3] = '\0';
|
||||||
|
|
|
@ -45,6 +45,7 @@ class FGTransmissionList {
|
||||||
typedef transmission_list_type::iterator transmission_list_iterator;
|
typedef transmission_list_type::iterator transmission_list_iterator;
|
||||||
typedef transmission_list_type::const_iterator transmission_list_const_iterator;
|
typedef transmission_list_type::const_iterator transmission_list_const_iterator;
|
||||||
|
|
||||||
|
// Map of transmission lists by station type
|
||||||
// typedef map < int, transmission_list_type, less<int> > transmission_map_type;
|
// typedef map < int, transmission_list_type, less<int> > transmission_map_type;
|
||||||
typedef map < int, transmission_list_type > transmission_map_type;
|
typedef map < int, transmission_list_type > transmission_map_type;
|
||||||
typedef transmission_map_type::iterator transmission_map_iterator;
|
typedef transmission_map_type::iterator transmission_map_iterator;
|
||||||
|
@ -65,6 +66,8 @@ public:
|
||||||
|
|
||||||
// generate the transmission text given the code of the message
|
// generate the transmission text given the code of the message
|
||||||
// and the parameters
|
// and the parameters
|
||||||
|
// Set ttext = true to generate the spoken transmission text,
|
||||||
|
// or false to generate the abridged menu entry text.
|
||||||
string gen_text(const int &station, const TransCode code,
|
string gen_text(const int &station, const TransCode code,
|
||||||
const TransPar &tpars, const bool ttext);
|
const TransPar &tpars, const bool ttext);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue