finalAcknowledged(false),
rwyVacatedReported(false),
rwyVacatedAcknowledged(false),
+ goAroundReported(false),
instructedToGoAround(false),
onRwy(false),
nextOnRwy(false),
finalAcknowledged(false),
rwyVacatedReported(false),
rwyVacatedAcknowledged(false),
+ goAroundReported(false),
instructedToGoAround(false),
onRwy(false),
nextOnRwy(false),
finalAcknowledged(false),
rwyVacatedReported(false),
rwyVacatedAcknowledged(false),
+ goAroundReported(false),
instructedToGoAround(false),
onRwy(false),
nextOnRwy(false),
finalAcknowledged(false),
rwyVacatedReported(false),
rwyVacatedAcknowledged(false),
+ goAroundReported(false),
instructedToGoAround(false),
onRwy(false),
nextOnRwy(false),
Report-Runway-Vacated is left as only user ATC option following a go-around. (MAJOR)
-Report Go-Around should be added to user options following reporting final or downwind. (MEDIUM).
-
Report-Downwind is not added as ATC option when user takes off to fly a circuit. (MAJOR)
eta of USER can be calculated very wrongly in circuit if flying straight out and turn4 etc are with +ve ortho y.
GO-AROUND is instructed very late at < 12s to landing - possibly make more dependent on chance of rwy clearing before landing (FEATURE)
Need to make clear when TowerPlaneRecs do or don't get deleted in RemoveFromCircuitList etc. (MINOR until I misuse it - then CRITICAL!)
+
+FGTower::RemoveAllUserDialogOptions() really ought to be replaced by an ATCDialog::clear_entries() function. (MINOR - efficiency).
*******************************************/
FGTower::FGTower() {
// For now assume that this means the user is not at the airport and is in the air.
// TODO FIXME - this will break when user starts on apron, at hold short, etc.
if(!OnAnyRunway(Point3D(user_lon_node->getDoubleValue(), user_lat_node->getDoubleValue(), 0.0))) {
+ //cout << ident << " ADD 0\n";
current_atcdialog->add_entry(ident, "@AP Tower @CS @MI miles @CD of the airport for full stop with the ATIS", "Contact tower for VFR arrival (full stop)", TOWER, (int)USER_REQUEST_VFR_ARRIVAL_FULL_STOP);
}
}
// Call the base class update for the response time handling.
FGATC::Update(dt);
+ /*
if(ident == "KEMT") {
// For AI debugging convienience - may be removed
Point3D user_pos;
fgSetDouble("/AI/user/ortho-y", user_ortho_pos.y());
fgSetDouble("/AI/user/elev", user_elev_node->getDoubleValue());
}
+ */
//cout << "Done T" << endl;
}
ReportFinal("USER");
} else if(code == (int)USER_REPORT_RWY_VACATED) {
ReportRunwayVacated("USER");
+ } else if(code == (int)USER_REPORT_GOING_AROUND) {
+ ReportGoingAround("USER");
}
}
}
if(t->isUser) {
if(t->opType == TTT_UNKNOWN) t->opType = CIRCUIT;
+ //cout << "ADD VACATED A\n";
+ // Put going around at the top (and hence default) since that'll be more desperate,
+ // or put rwy vacated at the top since that'll be more common?
+ current_atcdialog->add_entry(ident, "@CS Going Around", "Report going around", TOWER, USER_REPORT_GOING_AROUND);
current_atcdialog->add_entry(ident, "@CS Clear of the runway", "Report runway vacated", TOWER, USER_REPORT_RWY_VACATED);
- // TODO - add report going around as an option
}
} else if(t->holdShortReported) {
//cout << "Tower " << ident << " is reponding to holdShortReported...\n";
t->clearedToLand = true;
// Maybe remove report downwind from menu here as well incase user didn't bother to?
if(t->isUser) {
+ //cout << "ADD VACATED B\n";
+ // Put going around at the top (and hence default) since that'll be more desperate,
+ // or put rwy vacated at the top since that'll be more common?
+ current_atcdialog->add_entry(ident, "@CS Going Around", "Report going around", TOWER, USER_REPORT_GOING_AROUND);
current_atcdialog->add_entry(ident, "@CS Clear of the runway", "Report runway vacated", TOWER, USER_REPORT_RWY_VACATED);
- // TODO - add report going around as an option.
} else {
t->planePtr->RegisterTransmission(7);
}
void FGTower::ProcessRunwayVacatedReport(TowerPlaneRec* t) {
//cout << "Processing rwy vacated...\n";
+ current_atcdialog->remove_entry(ident, USER_REPORT_GOING_AROUND, TOWER);
string trns = t->plane.callsign;
if(separateGround) {
trns += " Contact ground on ";
if(t->isUser) {
// Change the communication options
RemoveAllUserDialogOptions();
+ //cout << "ADD A\n";
current_atcdialog->add_entry(ident, "@AP Tower @CS @MI miles @CD of the airport for full stop with the ATIS", "Contact tower for VFR arrival (full stop)", TOWER, (int)USER_REQUEST_VFR_ARRIVAL_FULL_STOP);
} else {
// Send a clear-of-airspace signal
CalcETA(t);
if(op == CIRCUIT && lg != LEG_UNKNOWN) {
- cout << "AAAAAAAAAAAAAAAaa" << endl;
AddToCircuitList(t);
- cout << "BBBBBBBBBBBBBBbbb" << endl;
} else {
// FLAG A WARNING
}
//void FGTower::ReportOuterMarker(string ID);
//void FGTower::ReportMiddleMarker(string ID);
//void FGTower::ReportInnerMarker(string ID);
-//void FGTower::ReportGoingAround(string ID);
void FGTower::ReportRunwayVacated(string ID) {
//cout << "Report Runway Vacated Called at tower " << ident << " by plane " << ID << '\n';
}
}
+void FGTower::ReportGoingAround(string ID) {
+ if(ID == "USER") {
+ ID = fgGetString("/sim/user/callsign");
+ RemoveAllUserDialogOptions(); // TODO - it would be much more efficient if ATCDialog simply had a clear() function!!!
+ current_atcdialog->add_entry(ident, "@AP Tower @CS Downwind @RW", "Report Downwind", TOWER, (int)USER_REPORT_DOWNWIND);
+ }
+ TowerPlaneRec* t = FindPlane(ID);
+ if(t) {
+ //t->goAroundReported = true; // No need to set this until we start responding to it.
+ responseReqd = false; // might change in the future but for now we'll not distract them during the go-around.
+ // If the plane is in the app list, remove it and put it in the circuit list instead.
+ RemoveFromAppList(ID);
+ t->leg = CLIMBOUT;
+ if(t->isUser) {
+ t->pos.setlon(user_lon_node->getDoubleValue());
+ t->pos.setlat(user_lat_node->getDoubleValue());
+ t->pos.setelev(user_elev_node->getDoubleValue());
+ } else {
+ // ASSERT(t->planePtr != NULL);
+ t->pos = t->planePtr->GetPos();
+ }
+ CalcETA(t);
+ AddToCircuitList(t);
+ } else {
+ SG_LOG(SG_ATC, SG_WARN, "WARNING: Unable to find plane " << ID << " in FGTower::ReportDownwind(...)");
+ }
+}
+
string FGTower::GenText(const string& m, int c) {
const int cmax = 300;
//string message;