1
0
Fork 0

Search ATC frequencies with both comm1 and 2 instead of just comm1 as previously

This commit is contained in:
daveluff 2003-01-07 13:11:00 +00:00
parent 6a45be1d72
commit c8a67cb773
4 changed files with 362 additions and 231 deletions

View file

@ -62,13 +62,14 @@ static void ATCDialogCancel(puObject *)
static void ATCDialogOK (puObject *me)
{
switch(globals->get_ATC_mgr()->GetCurrentATCType()) {
// Note that currently the dialog is hardwired to comm1 only here.
switch(globals->get_ATC_mgr()->GetComm1ATCType()) {
case INVALID:
break;
case ATIS:
break;
case TOWER: {
FGTower* twr = (FGTower*)globals->get_ATC_mgr()->GetCurrentATCPointer();
FGTower* twr = (FGTower*)globals->get_ATC_mgr()->GetComm1ATCPointer();
switch(atcDialogCommunicationOptions->getValue()) {
case 0:
cout << "Option 0 chosen\n";
@ -171,7 +172,20 @@ FGATCMgr::FGATCMgr() {
comm1_tower_valid = false;
comm1_approach_valid = false;
comm1_type = INVALID;
tuned_atc_ptr = NULL;
comm1_atc_ptr = NULL;
comm2_ident = "";
comm2_atis_ident = "";
comm2_tower_ident = "";
comm2_approach_ident = "";
last_comm2_ident = "";
last_comm2_atis_ident = "";
last_comm2_tower_ident = "";
last_comm2_approach_ident = "";
comm2_atis_valid = false;
comm2_tower_valid = false;
comm2_approach_valid = false;
comm2_type = INVALID;
comm2_atc_ptr = NULL;
}
FGATCMgr::~FGATCMgr() {
@ -245,8 +259,11 @@ void FGATCMgr::update(double dt) {
// Search the tuned frequencies every now and then - this should be done with the event scheduler
static int i = 0;
if(i == 15) {
Search(1);
}
if(i == 30) {
Search();
Search(2);
i = 0;
}
++i;
@ -297,9 +314,9 @@ FGATC* FGATCMgr::FindInList(const char* id, atc_type tp) {
atc_list_itr = atc_list.begin();
while(atc_list_itr != atc_list.end()) {
if( (!strcmp((*atc_list_itr)->GetIdent(), id))
&& ((*atc_list_itr)->GetType() == tp) ) {
return(*atc_list_itr);
} // Note that that can upset where we are in the list but that shouldn't really matter
&& ((*atc_list_itr)->GetType() == tp) ) {
return(*atc_list_itr);
} // Note that that can upset where we are in the list but that shouldn't really matter
++atc_list_itr;
}
// We need a fallback position
@ -369,8 +386,9 @@ FGATC* FGATCMgr::GetATCPointer(string icao, atc_type type) {
// Render a transmission
// Outputs the transmission either on screen or as audio depending on user preference
// The refname is a string to identify this sample to the sound manager
// The repeating flag indicates whether the message should be repeated continuously or played once.
void FGATCMgr::Render(string msg, bool repeating) {
void FGATCMgr::Render(string msg, string refname, bool repeating) {
#ifdef ENABLE_AUDIO_SUPPORT
voice = voiceOK && fgGetBool("/sim/sound/audible");
if(voice) {
@ -403,8 +421,7 @@ void FGATCMgr::Render(string msg, bool repeating) {
// Cease rendering a transmission.
// At the moment this can handle one transmission active at a time only.
void FGATCMgr::NoRender() {
void FGATCMgr::NoRender(string refname) {
if(playing) {
if(voice) {
#ifdef ENABLE_AUDIO_SUPPORT
@ -463,217 +480,312 @@ void FGATCMgr::doStandardDialog() {
// This is in ATCDialogOK()
}
void FGATCMgr::Search() {
////////////////////////////////////////////////////////////////
//
// TODO - The whole ATC frequency storage and search is really
// really ugly and needs reworking at some point.
//
////////////////////////////////////////////////////////////////
// Search the specified comm channel (1 or 2)
void FGATCMgr::Search(int chan) {
////////////////////////////////////////////////////////////////////////
// Comm1.
////////////////////////////////////////////////////////////////////////
//cout << "In FGATCMgr::Search() - atc_list.size = " << atc_list.size() << '\n';
comm1_freq = comm1_node->getDoubleValue();
//cout << "************* comm1_freq = " << comm1_freq << '\n';
double lon = lon_node->getDoubleValue();
double lat = lat_node->getDoubleValue();
double elev = elev_node->getDoubleValue() * SG_FEET_TO_METER;
// Store the comm1_type
//atc_type old_comm1_type = comm1_type;
// We must be able to generalise some of the repetetive searching below!
//Search for ATIS first
if(current_atislist->query(lon, lat, elev, comm1_freq, &atis)) {
//cout << "atis found in radiostack search !!!!" << endl;
//cout << "last_comm1_atis_ident = " << last_comm1_atis_ident << '\n';
//cout << "comm1_type " << comm1_type << '\n';
comm1_atis_ident = atis.GetIdent();
comm1_atis_valid = true;
if(last_comm1_atis_ident != comm1_atis_ident) {
if(last_comm1_atis_ident != "") {
RemoveFromList(last_comm1_atis_ident, ATIS);
}
last_comm1_atis_ident = comm1_atis_ident;
//cout << "last_comm1_atis_ident = " << last_comm1_atis_ident << '\n';
comm1_type = ATIS;
comm1_elev = atis.get_elev();
comm1_range = FG_ATIS_DEFAULT_RANGE;
comm1_effective_range = comm1_range;
comm1_x = atis.get_x();
comm1_y = atis.get_y();
comm1_z = atis.get_z();
FGATIS* a = new FGATIS;
*a = atis;
tuned_atc_ptr = a;
a->SetDisplay();
atc_list.push_back(a);
//cout << "Found a new atis station in range" << endl;
//cout << " id = " << atis.GetIdent() << endl;
return; //This rather assumes that we never have more than one type of station in range.
}
} else {
if(comm1_atis_valid) {
//cout << "Removing ATIS " << comm1_atis_ident << " from list\n";
RemoveFromList(comm1_atis_ident, ATIS);
comm1_atis_valid = false;
if(comm1_type == ATIS) {
comm1_type = INVALID;
}
comm1_atis_ident = "";
//comm1_trans_ident = "";
last_comm1_atis_ident = "";
tuned_atc_ptr = NULL;
}
//cout << "not picking up atis" << endl;
}
//Next search for tower
//cout << "comm1_freq = " << comm1_freq << '\n';
if(current_towerlist->query(lon, lat, elev, comm1_freq, &tower)) {
//cout << "tower found in radiostack search !!!!" << endl;
comm1_tower_ident = tower.GetIdent();
//cout << "comm1_tower_ident = " << comm1_tower_ident << '\n';
comm1_tower_valid = true;
if(last_comm1_tower_ident != comm1_tower_ident) {
if(last_comm1_tower_ident != "") {
RemoveFromList(last_comm1_tower_ident, TOWER);
}
last_comm1_tower_ident = comm1_tower_ident;
comm1_type = TOWER;
comm1_elev = tower.get_elev();
comm1_range = FG_TOWER_DEFAULT_RANGE;
comm1_effective_range = comm1_range;
comm1_x = tower.get_x();
comm1_y = tower.get_y();
comm1_z = tower.get_z();
FGTower* t = new FGTower;
*t = tower;
tuned_atc_ptr = t;
t->SetDisplay();
atc_list.push_back(t);
//cout << "Found a new tower station in range" << endl;
//cout << " id = " << tower.GetIdent() << endl;
return; //This rather assumes that we never have more than one type of station in range.
}
} else {
if(comm1_tower_valid) {
//cout << "removing tower\n";
RemoveFromList(comm1_tower_ident, TOWER);
//comm1_valid = false;
if(comm1_type == TOWER) {
comm1_type = INVALID; // Only invalidate if we haven't switched it to something else
}
comm1_tower_valid = false;
comm1_tower_ident = "";
last_comm1_tower_ident = "";
tuned_atc_ptr = NULL;
//comm1_ident = "";
//comm1_trans_ident = "";
//last_comm1_ident = "";
}
//cout << "not picking up tower" << endl;
}
/*
//Next search for Ground control
if(current_groundlist->query(lon, lat, elev, comm1_freq, &ground)) {
//cout << "Ground Control found in radiostack search !!!!" << endl;
comm1_ident = ground.GetIdent();
comm1_valid = true;
if((last_comm1_ident != comm1_ident) || (comm1_type != GROUND)) {
if(last_comm1_ident != "") {
RemoveFromList(last_comm1_ident, GROUND);
}
last_comm1_ident = comm1_ident;
comm1_type = GROUND;
comm1_elev = ground.get_elev();
comm1_range = FG_GROUND_DEFAULT_RANGE;
comm1_effective_range = comm1_range;
comm1_x = ground.get_x();
comm1_y = ground.get_y();
comm1_z = ground.get_z();
FGGround* g = new FGGround;
*g = ground;
g->SetDisplay();
atc_list.push_back(g);
// For now we will automatically make contact with ground when the radio is tuned.
// This rather assumes that the user tunes the radio at the appropriate place
// (ie. having just turned off the runway) and only uses ground control on arrival
// but its a start!
g->NewArrival(current_plane);
//cout << "Found a new ground station in range" << endl;
//cout << " id = " << ground.GetIdent() << endl;
return; //This rather assumes that we never have more than one type of station in range.
}
} else {
if((comm1_valid) && (comm1_type == GROUND)) {
RemoveFromList(comm1_ident, GROUND);
comm1_valid = false;
comm1_type = INVALID;
comm1_ident = "";
//comm1_trans_ident = "";
last_comm1_ident = "";
}
//cout << "not picking up ground control" << endl;
}
*/
// ================================================================================
// Search for Approach stations
// ================================================================================
// init number of approach stations reachable by plane
int num_app = 0;
// search stations in range
current_approachlist->query_bck(lon, lat, elev, approaches, max_app, num_app);
if (num_app != 0) {
//cout << num_app << " approaches found in radiostack search !!!!" << endl;
if(chan == 1) {
////////////////////////////////////////////////////////////////////////
// Comm1.
////////////////////////////////////////////////////////////////////////
//cout << "In FGATCMgr::Search() - atc_list.size = " << atc_list.size() << '\n';
for ( int i=0; i<num_app; i++ ) {
bool new_app = true;
approach_ident = approaches[i].GetIdent();
// check if station already exists on ATC stack
atc_list_itr = atc_list.begin();
while(atc_list_itr != atc_list.end()) {
//cout << "ATC list: " << (*atc_list_itr)->GetIdent() << endl;
if((!strcmp((*atc_list_itr)->GetIdent(), approach_ident))
&& ((*atc_list_itr)->GetType() == APPROACH) ) {
new_app = false;
string pid = "Player";
(*atc_list_itr)->AddPlane(pid);
(*atc_list_itr)->Update();
break;
}
++atc_list_itr;
}
// generate new Approach on ATC stack
if (new_app) {
FGApproach* a = new FGApproach;
*a = approaches[i];
string pid = "Player";
a->AddPlane(pid);
a->Update();
comm1_freq = comm1_node->getDoubleValue();
//cout << "************* comm1_freq = " << comm1_freq << '\n';
double lon = lon_node->getDoubleValue();
double lat = lat_node->getDoubleValue();
double elev = elev_node->getDoubleValue() * SG_FEET_TO_METER;
// We must be able to generalise some of the repetetive searching below!
//Search for ATIS first
if(current_atislist->query(lon, lat, elev, comm1_freq, &atis)) {
//cout << "atis found in radiostack search !!!!" << endl;
//cout << "last_comm1_atis_ident = " << last_comm1_atis_ident << '\n';
//cout << "comm1_type " << comm1_type << '\n';
comm1_atis_ident = atis.GetIdent();
comm1_atis_valid = true;
if(last_comm1_atis_ident != comm1_atis_ident) {
if(last_comm1_atis_ident != "") {
RemoveFromList(last_comm1_atis_ident, ATIS);
}
last_comm1_atis_ident = comm1_atis_ident;
//cout << "last_comm1_atis_ident = " << last_comm1_atis_ident << '\n';
comm1_type = ATIS;
comm1_elev = atis.get_elev();
comm1_range = FG_ATIS_DEFAULT_RANGE;
comm1_effective_range = comm1_range;
comm1_x = atis.get_x();
comm1_y = atis.get_y();
comm1_z = atis.get_z();
FGATIS* a = new FGATIS;
*a = atis;
comm1_atc_ptr = a;
a->SetDisplay();
tuned_atc_ptr = a;
a->set_refname("atis1");
atc_list.push_back(a);
//cout << "Found a new approach station in range: Id = "
// << approaches[i].GetIdent() << endl;
//cout << "Found a new atis station in range" << endl;
//cout << " id = " << atis.GetIdent() << endl;
return; //This rather assumes that we never have more than one type of station in range.
}
} else {
if(comm1_atis_valid) {
//cout << "Removing ATIS " << comm1_atis_ident << " from list\n";
RemoveFromList(comm1_atis_ident, ATIS);
comm1_atis_valid = false;
if(comm1_type == ATIS) {
comm1_type = INVALID;
}
comm1_atis_ident = "";
//comm1_trans_ident = "";
last_comm1_atis_ident = "";
comm1_atc_ptr = NULL;
}
//cout << "not picking up atis" << endl;
}
//Next search for tower
//cout << "comm1_freq = " << comm1_freq << '\n';
if(current_towerlist->query(lon, lat, elev, comm1_freq, &tower)) {
//cout << "tower found in radiostack search !!!!" << endl;
comm1_tower_ident = tower.GetIdent();
//cout << "comm1_tower_ident = " << comm1_tower_ident << '\n';
comm1_tower_valid = true;
if(last_comm1_tower_ident != comm1_tower_ident) {
if(last_comm1_tower_ident != "") {
RemoveFromList(last_comm1_tower_ident, TOWER);
}
last_comm1_tower_ident = comm1_tower_ident;
comm1_type = TOWER;
comm1_elev = tower.get_elev();
comm1_range = FG_TOWER_DEFAULT_RANGE;
comm1_effective_range = comm1_range;
comm1_x = tower.get_x();
comm1_y = tower.get_y();
comm1_z = tower.get_z();
FGTower* t = new FGTower;
*t = tower;
comm1_atc_ptr = t;
t->SetDisplay();
atc_list.push_back(t);
//cout << "Found a new tower station in range" << endl;
//cout << " id = " << tower.GetIdent() << endl;
return; //This rather assumes that we never have more than one type of station in range.
}
} else {
if(comm1_tower_valid) {
//cout << "removing tower\n";
RemoveFromList(comm1_tower_ident, TOWER);
//comm1_valid = false;
if(comm1_type == TOWER) {
comm1_type = INVALID; // Only invalidate if we haven't switched it to something else
}
comm1_tower_valid = false;
comm1_tower_ident = "";
last_comm1_tower_ident = "";
comm1_atc_ptr = NULL;
//comm1_ident = "";
//comm1_trans_ident = "";
//last_comm1_ident = "";
}
//cout << "not picking up tower" << endl;
}
/*
//Next search for Ground control
if(current_groundlist->query(lon, lat, elev, comm1_freq, &ground)) {
//cout << "Ground Control found in radiostack search !!!!" << endl;
comm1_ident = ground.GetIdent();
comm1_valid = true;
if((last_comm1_ident != comm1_ident) || (comm1_type != GROUND)) {
if(last_comm1_ident != "") {
RemoveFromList(last_comm1_ident, GROUND);
}
last_comm1_ident = comm1_ident;
comm1_type = GROUND;
comm1_elev = ground.get_elev();
comm1_range = FG_GROUND_DEFAULT_RANGE;
comm1_effective_range = comm1_range;
comm1_x = ground.get_x();
comm1_y = ground.get_y();
comm1_z = ground.get_z();
FGGround* g = new FGGround;
*g = ground;
g->SetDisplay();
atc_list.push_back(g);
// For now we will automatically make contact with ground when the radio is tuned.
// This rather assumes that the user tunes the radio at the appropriate place
// (ie. having just turned off the runway) and only uses ground control on arrival
// but its a start!
g->NewArrival(current_plane);
//cout << "Found a new ground station in range" << endl;
//cout << " id = " << ground.GetIdent() << endl;
return; //This rather assumes that we never have more than one type of station in range.
}
} else {
if((comm1_valid) && (comm1_type == GROUND)) {
RemoveFromList(comm1_ident, GROUND);
comm1_valid = false;
comm1_type = INVALID;
comm1_ident = "";
//comm1_trans_ident = "";
last_comm1_ident = "";
}
//cout << "not picking up ground control" << endl;
}
*/
// ================================================================================
// Search for Approach stations
// ================================================================================
// init number of approach stations reachable by plane
int num_app = 0;
// search stations in range
current_approachlist->query_bck(lon, lat, elev, approaches, max_app, num_app);
if (num_app != 0) {
//cout << num_app << " approaches found in radiostack search !!!!" << endl;
for ( int i=0; i<num_app; i++ ) {
bool new_app = true;
approach_ident = approaches[i].GetIdent();
// check if station already exists on ATC stack
atc_list_itr = atc_list.begin();
while(atc_list_itr != atc_list.end()) {
//cout << "ATC list: " << (*atc_list_itr)->GetIdent() << endl;
if((!strcmp((*atc_list_itr)->GetIdent(), approach_ident))
&& ((*atc_list_itr)->GetType() == APPROACH) ) {
new_app = false;
string pid = "Player";
(*atc_list_itr)->AddPlane(pid);
(*atc_list_itr)->Update();
break;
}
++atc_list_itr;
}
// generate new Approach on ATC stack
if (new_app) {
FGApproach* a = new FGApproach;
*a = approaches[i];
string pid = "Player";
a->AddPlane(pid);
a->Update();
a->SetDisplay();
comm1_atc_ptr = a;
atc_list.push_back(a);
//cout << "Found a new approach station in range: Id = "
// << approaches[i].GetIdent() << endl;
}
}
}
}
// remove planes which are out of range
atc_list_itr = atc_list.begin();
while(atc_list_itr != atc_list.end()) {
if((*atc_list_itr)->GetType() == APPROACH ) {
int np = (*atc_list_itr)->RemovePlane();
// if approach has no planes left remove it from ATC list
if ( np == 0) {
(*atc_list_itr)->SetNoDisplay();
(*atc_list_itr)->Update();
delete (*atc_list_itr);
atc_list_itr = atc_list.erase(atc_list_itr);
break; // the other stations will be checked next time
// remove planes which are out of range
atc_list_itr = atc_list.begin();
while(atc_list_itr != atc_list.end()) {
if((*atc_list_itr)->GetType() == APPROACH ) {
int np = (*atc_list_itr)->RemovePlane();
// if approach has no planes left remove it from ATC list
if ( np == 0) {
(*atc_list_itr)->SetNoDisplay();
(*atc_list_itr)->Update();
delete (*atc_list_itr);
atc_list_itr = atc_list.erase(atc_list_itr);
break; // the other stations will be checked next time
}
}
++atc_list_itr;
}
} else { // chan = 2
////////////////////////////////////////////////////////////////////////
// Comm2.
////////////////////////////////////////////////////////////////////////
//cout << "In FGATCMgr::Search() - atc_list.size = " << atc_list.size() << '\n';
comm2_freq = comm2_node->getDoubleValue();
//cout << "************* comm1_freq = " << comm1_freq << '\n';
double lon = lon_node->getDoubleValue();
double lat = lat_node->getDoubleValue();
double elev = elev_node->getDoubleValue() * SG_FEET_TO_METER;
if(current_atislist->query(lon, lat, elev, comm2_freq, &atis)) {
comm2_atis_ident = atis.GetIdent();
comm2_atis_valid = true;
if(last_comm2_atis_ident != comm2_atis_ident) {
if(last_comm2_atis_ident != "") {
RemoveFromList(last_comm2_atis_ident, ATIS);
}
last_comm2_atis_ident = comm2_atis_ident;
comm2_type = ATIS;
comm2_elev = atis.get_elev();
comm2_range = FG_ATIS_DEFAULT_RANGE;
comm2_effective_range = comm2_range;
comm2_x = atis.get_x();
comm2_y = atis.get_y();
comm2_z = atis.get_z();
FGATIS* a = new FGATIS;
*a = atis;
comm2_atc_ptr = a;
a->SetDisplay();
a->set_refname("atis2");
atc_list.push_back(a);
//cout << "Found a new atis station in range" << endl;
//cout << " id = " << atis.GetIdent() << endl;
return; //This rather assumes that we never have more than one type of station in range.
}
} else {
if(comm2_atis_valid) {
RemoveFromList(comm2_atis_ident, ATIS);
comm2_atis_valid = false;
if(comm2_type == ATIS) {
comm2_type = INVALID;
}
comm2_atis_ident = "";
//comm2_trans_ident = "";
last_comm2_atis_ident = "";
comm2_atc_ptr = NULL;
}
}
if(current_towerlist->query(lon, lat, elev, comm2_freq, &tower)) {
//cout << "tower found in radiostack search !!!!" << endl;
comm2_tower_ident = tower.GetIdent();
comm2_tower_valid = true;
if(last_comm2_tower_ident != comm2_tower_ident) {
if(last_comm2_tower_ident != "") {
RemoveFromList(last_comm2_tower_ident, TOWER);
}
last_comm2_tower_ident = comm2_tower_ident;
comm2_type = TOWER;
comm2_elev = tower.get_elev();
comm2_range = FG_TOWER_DEFAULT_RANGE;
comm2_effective_range = comm2_range;
comm2_x = tower.get_x();
comm2_y = tower.get_y();
comm2_z = tower.get_z();
FGTower* t = new FGTower;
*t = tower;
comm2_atc_ptr = t;
t->SetDisplay();
atc_list.push_back(t);
return;
}
} else {
if(comm2_tower_valid) {
RemoveFromList(comm2_tower_ident, TOWER);
if(comm2_type == TOWER) {
comm2_type = INVALID; // Only invalidate if we haven't switched it to something else
}
comm2_tower_valid = false;
comm2_tower_ident = "";
last_comm2_tower_ident = "";
comm2_atc_ptr = NULL;
}
}
++atc_list_itr;
}
}

View file

@ -104,7 +104,8 @@ private:
atc_type comm2_type;
// Pointer to the ATC station that the user is currently tuned into.
FGATC* tuned_atc_ptr;
FGATC* comm1_atc_ptr;
FGATC* comm2_atc_ptr;
double comm1_freq;
double comm2_freq;
@ -118,9 +119,11 @@ private:
SGPropertyNode* lat_node;
SGPropertyNode* elev_node;
// Position of the ATC that the comm radios are tuned to in order to decide whether transmission
// will be received
// Position of the ATC that the comm radios are tuned to in order to decide
// whether transmission will be received.
double comm1_x, comm1_y, comm1_z, comm1_elev;
double comm2_x, comm2_y, comm2_z, comm2_elev;
double comm1_range, comm1_effective_range;
bool comm1_valid;
bool comm1_atis_valid;
@ -134,13 +137,23 @@ private:
const char* last_comm1_atis_ident;
const char* last_comm1_tower_ident;
const char* last_comm1_approach_ident;
const char* approach_ident;
bool last_in_range;
double comm2_x, comm2_y, comm2_z, comm2_elev;
double comm2_range, comm2_effective_range;
bool comm2_valid;
bool comm2_atis_valid;
bool comm2_tower_valid;
bool comm2_approach_valid;
const char* comm2_ident;
const char* comm2_atis_ident;
const char* comm2_tower_ident;
const char* comm2_approach_ident;
const char* last_comm2_ident;
const char* last_comm2_atis_ident;
const char* last_comm2_tower_ident;
const char* last_comm2_approach_ident;
const char* approach_ident;
bool last_in_range;
FGATIS atis;
//FGGround ground;
@ -153,7 +166,6 @@ private:
bool voice; // Flag - true if we are using voice
bool playing; // Indicates a message in progress
#ifdef ENABLE_AUDIO_SUPPORT
string refname; // FIXME - A hack - assumes only one sound to track.
bool voiceOK; // Flag - true if at least one voice has loaded OK
FGATCVoice v1;
#endif
@ -179,18 +191,21 @@ public:
// Render a transmission
// Outputs the transmission either on screen or as audio depending on user preference
// The refname is a string to identify this sample to the sound manager
// The repeating flag indicates whether the message should be repeated continuously or played once.
void Render(string msg, bool repeating);
void Render(string msg, string refname, bool repeating);
// Cease rendering a transmission.
// At the moment this can handle one transmission active at a time only.
void NoRender();
// Requires the sound manager refname if audio, else "".
void NoRender(string refname);
// Display a dialog box with options relevant to the currently tuned ATC service.
void doStandardDialog();
atc_type GetCurrentATCType() { return(comm1_type); }
FGATC* GetCurrentATCPointer() { return(tuned_atc_ptr); }
atc_type GetComm1ATCType() { return(comm1_type); }
FGATC* GetComm1ATCPointer() { return(comm1_atc_ptr); }
atc_type GetComm2ATCType() { return(comm2_type); }
FGATC* GetComm2ATCPointer() { return(comm2_atc_ptr); }
private:
@ -200,8 +215,8 @@ private:
// Return a pointer to a class in the list (external interface to this is through GetATCPointer)
FGATC* FindInList(const char* id, atc_type tp);
// Search a specified freq for matching stations
void Search();
// Search the specified channel for stations on the same frequency and in range.
void Search(int chan);
};

View file

@ -69,7 +69,8 @@ ident(""),
name(""),
transmission(""),
trans_ident(""),
atis_failed(false)
atis_failed(false),
refname("atis")
{
}
@ -88,14 +89,14 @@ void FGATIS::Update() {
// We need to get and display the message
UpdateTransmission();
//cout << "ATIS.CXX - calling ATCMgr to render transmission..." << endl;
globals->get_ATC_mgr()->Render(transmission, true);
globals->get_ATC_mgr()->Render(transmission, refname, true);
displaying = true;
}
} else {
// We shouldn't be displaying
if(displaying) {
//cout << "ATIS.CXX - calling NoRender()..." << endl;
globals->get_ATC_mgr()->NoRender();
globals->get_ATC_mgr()->NoRender(refname);
displaying = false;
}
}

View file

@ -104,9 +104,12 @@ class FGATIS : public FGATC {
inline const char* GetIdent() { return ident.c_str(); }
inline string get_trans_ident() { return trans_ident; }
inline atc_type GetType() { return ATIS; }
inline void set_refname(string r) { refname = r; }
private:
string refname; // Holds the refname of a transmission in progress
//Update the transmission string
void UpdateTransmission(void);