1
0
Fork 0

Fix state changes related to hold position and resume taxi ATC instruction.

This commit is contained in:
Durk Talsma 2011-08-08 21:50:44 +02:00
parent b5025ccf5d
commit 8212c88969

View file

@ -906,30 +906,30 @@ void FGGroundNetwork::checkHoldPosition(int id, double lat,
} }
} }
bool currStatus = current->hasHoldPosition(); bool currStatus = current->hasHoldPosition();
current->setHoldPosition(origStatus);
// Either a Hold Position or a resume taxi transmission has been issued // Either a Hold Position or a resume taxi transmission has been issued
time_t now = time(NULL) + fgGetLong("/sim/time/warp"); time_t now = time(NULL) + fgGetLong("/sim/time/warp");
if ((now - lastTransmission) > 2) { if ((now - lastTransmission) > 2) {
available = true; available = true;
} }
if ((origStatus != currStatus) && available) { if (current->getState() == 0) {
//cerr << "Issueing hold short instrudtion " << currStatus << " " << available << endl; if ((origStatus != currStatus) && available) {
if (currStatus == true) { // No has a hold short instruction cerr << "Issueing hold short instrudtion " << currStatus << " " << available << endl;
transmit(&(*current), MSG_HOLD_POSITION, ATC_GROUND_TO_AIR, true); if (currStatus == true) { // No has a hold short instruction
//cerr << "Transmittin hold short instrudtion " << currStatus << " " << available << endl; transmit(&(*current), MSG_HOLD_POSITION, ATC_GROUND_TO_AIR, true);
current->setState(1); cerr << "Transmittin hold short instrudtion " << currStatus << " " << available << endl;
} else { current->setState(1);
transmit(&(*current), MSG_RESUME_TAXI, ATC_GROUND_TO_AIR, true); } else {
//cerr << "Transmittig resume instrudtion " << currStatus << " " << available << endl; transmit(&(*current), MSG_RESUME_TAXI, ATC_GROUND_TO_AIR, true);
current->setState(2); cerr << "Transmittig resume instrudtion " << currStatus << " " << available << endl;
current->setState(2);
}
lastTransmission = now;
available = false;
// Don't act on the changed instruction until the transmission is confirmed
// So set back to original status
//cerr << "Current state " << current->getState() << endl;
} }
lastTransmission = now;
available = false;
// Don't act on the changed instruction until the transmission is confirmed
// So set back to original status
current->setHoldPosition(origStatus);
//cerr << "Current state " << current->getState() << endl;
} else {
} }
//int state = current->getState(); //int state = current->getState();
if (checkTransmissionState(1,1, current, now, MSG_ACKNOWLEDGE_HOLD_POSITION, ATC_AIR_TO_GROUND)) { if (checkTransmissionState(1,1, current, now, MSG_ACKNOWLEDGE_HOLD_POSITION, ATC_AIR_TO_GROUND)) {