#include <Airports/groundnetwork.hxx>
#include <Airports/dynamics.hxx>
#include <Airports/simple.hxx>
+#include <Radio/radio.hxx>
using std::sort;
if (intentions.size()) {
intVecIterator i = intentions.begin();
if ((*i) != pos) {
- SG_LOG(SG_GENERAL, SG_ALERT,
+ SG_LOG(SG_ATC, SG_ALERT,
"Error in FGTrafficRecord::setPositionAndIntentions at " << SG_ORIGIN);
cerr << "Pos : " << pos << " Curr " << *(intentions.begin()) << endl;
for (intVecIterator i = intentions.begin();
|| (onBoardRadioFreqI1 == stationFreq)) {
if (rec->allowTransmissions()) {
- fgSetString("/sim/messages/atc", text.c_str());
+ if( fgGetBool( "/sim/radio/use-itm-attenuation", false ) ) {
+ //cerr << "Using ITM radio propagation" << endl;
+ FGRadioTransmission* radio = new FGRadioTransmission();
+ SGGeod sender_pos;
+ double sender_alt_ft, sender_alt;
+ if(ground_to_air) {
+ sender_alt_ft = parent->getElevation();
+ sender_alt = sender_alt_ft * SG_FEET_TO_METER;
+ sender_pos= SGGeod::fromDegM( parent->getLongitude(),
+ parent->getLatitude(), sender_alt );
+ }
+ else {
+ sender_alt_ft = rec->getAltitude();
+ sender_alt = sender_alt_ft * SG_FEET_TO_METER;
+ sender_pos= SGGeod::fromDegM( rec->getLongitude(),
+ rec->getLatitude(), sender_alt );
+ }
+ double frequency = ((double)stationFreq) / 100;
+ radio->receiveATC(sender_pos, frequency, text, ground_to_air);
+ delete radio;
+ }
+ else {
+ fgSetString("/sim/messages/atc", text.c_str());
+ }
}
}
} else {
}
// // update position of the current aircraft
if (i == activeTraffic.end() || (activeTraffic.size() == 0)) {
- SG_LOG(SG_GENERAL, SG_ALERT,
+ SG_LOG(SG_ATC, SG_ALERT,
"AI error: updating aircraft without traffic record at " << SG_ORIGIN);
} else {
i->setPositionAndHeading(lat, lon, heading, speed, alt);
rwy->setCleared(0);
rwy->updateDepartureCue();
} else {
- SG_LOG(SG_GENERAL, SG_ALERT,
+ SG_LOG(SG_ATC, SG_ALERT,
"AI error: Attempting to erase non-existing runway clearance record in FGTowerController::signoff at " << SG_ORIGIN);
}
}
if (i == activeTraffic.end() || (activeTraffic.size() == 0)) {
- SG_LOG(SG_GENERAL, SG_ALERT,
+ SG_LOG(SG_ATC, SG_ALERT,
"AI error: Aircraft without traffic record is signing off from tower at " << SG_ORIGIN);
} else {
i->getAircraft()->resetTakeOffStatus();
}
}
if (i == activeTraffic.end() || (activeTraffic.size() == 0)) {
- SG_LOG(SG_GENERAL, SG_ALERT,
+ SG_LOG(SG_ATC, SG_ALERT,
"AI error: checking ATC instruction for aircraft without traffic record at " << SG_ORIGIN);
} else {
return i->hasInstruction();
}
}
if (i == activeTraffic.end() || (activeTraffic.size() == 0)) {
- SG_LOG(SG_GENERAL, SG_ALERT,
+ SG_LOG(SG_ATC, SG_ALERT,
"AI error: requesting ATC instruction for aircraft without traffic record at " << SG_ORIGIN);
} else {
return i->getInstruction();
}
}
if (i == activeTraffic.end() || (activeTraffic.size() == 0)) {
- SG_LOG(SG_GENERAL, SG_ALERT,
+ SG_LOG(SG_ATC, SG_ALERT,
"AI error: checking ATC instruction for aircraft without traffic record at " << SG_ORIGIN);
} else {
return i->hasInstruction();
}
}
if (i == activeTraffic.end() || (activeTraffic.size() == 0)) {
- SG_LOG(SG_GENERAL, SG_ALERT,
+ SG_LOG(SG_ATC, SG_ALERT,
"AI error: requesting ATC instruction for aircraft without traffic record at " << SG_ORIGIN);
} else {
return i->getInstruction();
}
}
if (i == activeTraffic.end() || (activeTraffic.size() == 0)) {
- SG_LOG(SG_GENERAL, SG_ALERT,
+ SG_LOG(SG_ATC, SG_ALERT,
"AI error: Aircraft without traffic record is signing off from tower at " << SG_ORIGIN);
} else {
//cerr << i->getAircraft()->getCallSign() << " signing off from startupcontroller" << endl;
// // update position of the current aircraft
if (i == activeTraffic.end() || (activeTraffic.size() == 0)) {
- SG_LOG(SG_GENERAL, SG_ALERT,
+ SG_LOG(SG_ATC, SG_ALERT,
"AI error: updating aircraft without traffic record at " << SG_ORIGIN);
} else {
i->setPositionAndHeading(lat, lon, heading, speed, alt);
}
// // update position of the current aircraft
if (i == activeTraffic.end() || (activeTraffic.size() == 0)) {
- SG_LOG(SG_GENERAL, SG_ALERT,
+ SG_LOG(SG_ATC, SG_ALERT,
"AI error: updating aircraft without traffic record at " << SG_ORIGIN);
} else {
i->setPositionAndHeading(lat, lon, heading, speed, alt);
}
}
if (i == activeTraffic.end() || (activeTraffic.size() == 0)) {
- SG_LOG(SG_GENERAL, SG_ALERT,
+ SG_LOG(SG_ATC, SG_ALERT,
"AI error: Aircraft without traffic record is signing off from approach at " << SG_ORIGIN);
} else {
i = activeTraffic.erase(i);
}
}
if (i == activeTraffic.end() || (activeTraffic.size() == 0)) {
- SG_LOG(SG_GENERAL, SG_ALERT,
+ SG_LOG(SG_ATC, SG_ALERT,
"AI error: checking ATC instruction for aircraft without traffic record at " << SG_ORIGIN);
} else {
return i->hasInstruction();
}
}
if (i == activeTraffic.end() || (activeTraffic.size() == 0)) {
- SG_LOG(SG_GENERAL, SG_ALERT,
+ SG_LOG(SG_ATC, SG_ALERT,
"AI error: requesting ATC instruction for aircraft without traffic record at " << SG_ORIGIN);
} else {
return i->getInstruction();