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 (current->getState() == 0) {
if ((origStatus != currStatus) && available) { if ((origStatus != currStatus) && available) {
//cerr << "Issueing hold short instrudtion " << currStatus << " " << available << endl; cerr << "Issueing hold short instrudtion " << currStatus << " " << available << endl;
if (currStatus == true) { // No has a hold short instruction if (currStatus == true) { // No has a hold short instruction
transmit(&(*current), MSG_HOLD_POSITION, ATC_GROUND_TO_AIR, true); transmit(&(*current), MSG_HOLD_POSITION, ATC_GROUND_TO_AIR, true);
//cerr << "Transmittin hold short instrudtion " << currStatus << " " << available << endl; cerr << "Transmittin hold short instrudtion " << currStatus << " " << available << endl;
current->setState(1); current->setState(1);
} else { } else {
transmit(&(*current), MSG_RESUME_TAXI, ATC_GROUND_TO_AIR, true); transmit(&(*current), MSG_RESUME_TAXI, ATC_GROUND_TO_AIR, true);
//cerr << "Transmittig resume instrudtion " << currStatus << " " << available << endl; cerr << "Transmittig resume instrudtion " << currStatus << " " << available << endl;
current->setState(2); current->setState(2);
} }
lastTransmission = now; lastTransmission = now;
available = false; available = false;
// Don't act on the changed instruction until the transmission is confirmed // Don't act on the changed instruction until the transmission is confirmed
// So set back to original status // So set back to original status
current->setHoldPosition(origStatus);
//cerr << "Current state " << current->getState() << endl; //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)) {