Enable Radio #2.
This commit is contained in:
parent
41f7fc256c
commit
85ec807d97
1 changed files with 13 additions and 7 deletions
|
@ -1,4 +1,4 @@
|
||||||
// trafficrecord.cxx - Implementation of AIModels ATC code.
|
/// trafficrecord.cxx - Implementation of AIModels ATC code.
|
||||||
//
|
//
|
||||||
// Written by Durk Talsma, started September 2006.
|
// Written by Durk Talsma, started September 2006.
|
||||||
//
|
//
|
||||||
|
@ -335,14 +335,14 @@ string FGATCController::getGateName(FGAIAircraft *ref)
|
||||||
void FGATCController::transmit(FGTrafficRecord *rec, AtcMsgId msgId, AtcMsgDir msgDir)
|
void FGATCController::transmit(FGTrafficRecord *rec, AtcMsgId msgId, AtcMsgDir msgDir)
|
||||||
{
|
{
|
||||||
string sender, receiver;
|
string sender, receiver;
|
||||||
int commFreq = 0;
|
int stationFreq = 0;
|
||||||
//double commFreqD;
|
//double commFreqD;
|
||||||
switch (msgDir) {
|
switch (msgDir) {
|
||||||
case ATC_AIR_TO_GROUND:
|
case ATC_AIR_TO_GROUND:
|
||||||
sender = rec->getAircraft()->getTrafficRef()->getCallSign();
|
sender = rec->getAircraft()->getTrafficRef()->getCallSign();
|
||||||
switch (rec->getLeg()) {
|
switch (rec->getLeg()) {
|
||||||
case 2:
|
case 2:
|
||||||
commFreq =
|
stationFreq =
|
||||||
rec->getAircraft()->getTrafficRef()->getDepartureAirport()->getDynamics()->getGroundFrequency();
|
rec->getAircraft()->getTrafficRef()->getDepartureAirport()->getDynamics()->getGroundFrequency();
|
||||||
receiver = rec->getAircraft()->getTrafficRef()->getDepartureAirport()->getName() + "-Ground";
|
receiver = rec->getAircraft()->getTrafficRef()->getDepartureAirport()->getName() + "-Ground";
|
||||||
break;
|
break;
|
||||||
|
@ -358,7 +358,7 @@ void FGATCController::transmit(FGTrafficRecord *rec, AtcMsgId msgId, AtcMsgDir m
|
||||||
receiver = rec->getAircraft()->getTrafficRef()->getCallSign();
|
receiver = rec->getAircraft()->getTrafficRef()->getCallSign();
|
||||||
switch (rec->getLeg()) {
|
switch (rec->getLeg()) {
|
||||||
case 2:
|
case 2:
|
||||||
commFreq =
|
stationFreq =
|
||||||
rec->getAircraft()->getTrafficRef()->getDepartureAirport()->getDynamics()->getGroundFrequency();
|
rec->getAircraft()->getTrafficRef()->getDepartureAirport()->getDynamics()->getGroundFrequency();
|
||||||
sender = rec->getAircraft()->getTrafficRef()->getDepartureAirport()->getName() + "-Ground";
|
sender = rec->getAircraft()->getTrafficRef()->getDepartureAirport()->getName() + "-Ground";
|
||||||
break;
|
break;
|
||||||
|
@ -396,10 +396,16 @@ void FGATCController::transmit(FGTrafficRecord *rec, AtcMsgId msgId, AtcMsgDir m
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
double currFreq = fgGetDouble("/instrumentation/comm/frequencies/selected-mhz");
|
double onBoardRadioFreq0 = fgGetDouble("/instrumentation/comm[0]/frequencies/selected-mhz");
|
||||||
int currFreqI = (int) floor(currFreq * 100 + 0.5);
|
double onBoardRadioFreq1 = fgGetDouble("/instrumentation/comm[1]/frequencies/selected-mhz");
|
||||||
|
int onBoardRadioFreqI0 = (int) floor(onBoardRadioFreq0 * 100 + 0.5);
|
||||||
|
int onBoardRadioFreqI1 = (int) floor(onBoardRadioFreq1 * 100 + 0.5);
|
||||||
//cerr << "Using " << currFreqI << " and " << commFreq << endl;
|
//cerr << "Using " << currFreqI << " and " << commFreq << endl;
|
||||||
if (currFreqI == commFreq) {
|
|
||||||
|
// Display ATC message only when one of the radios is tuned
|
||||||
|
// the relevant frequency.
|
||||||
|
// Note that distance attenuation is currently not yet implemented
|
||||||
|
if ((onBoardRadioFreqI0 == stationFreq) || (onBoardRadioFreqI1 == stationFreq)) {
|
||||||
fgSetString("/sim/messages/atc", text.c_str());
|
fgSetString("/sim/messages/atc", text.c_str());
|
||||||
//cerr << "Printing Message: " << endl;
|
//cerr << "Printing Message: " << endl;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue