props->tie("controls/gear/gear-down",
SGRawValueMethods<FGAIAircraft,bool>(*this,
&FGAIAircraft::_getGearDown));
+ props->tie("transponder-id",
+ SGRawValueMethods<FGAIAircraft,const char*>(*this,
+ &FGAIAircraft::_getTransponderCode));
}
FGAIBase::unbind();
props->untie("controls/gear/gear-down");
+ props->untie("transponder-id");
}
}
+const char * FGAIAircraft::_getTransponderCode() const {
+ return transponderCode.c_str();
+}
+
+
bool FGAIAircraft::loadNextLeg() {
int leg;
virtual const char* getTypeString(void) const { return "aircraft"; }
+ string GetTransponderCode() { return transponderCode; };
+ void SetTransponderCode(string tc) { transponderCode = tc;};
+
// included as performance data needs them, who else?
inline PerformanceData* getPerformance() { return _performance; };
inline bool onGround() const { return no_roll; };
string acType;
string company;
+ string transponderCode;
int spinCounter;
double prevSpeed;
bool _getGearDown() const;
+ const char * _getTransponderCode() const;
+
bool reachedWaypoint;
time_t timeElapsed;
string fltType;
string rwyClass;
string SID;
+ string transponderCode;
FGAIFlightPlan *fp;
+ string fltRules;
switch (msgId) {
case MSG_ANNOUNCE_ENGINE_START:
text = sender + ". Ready to Start up";
SID = "fly runway heading ";
}
//snprintf(buffer, 7, "%3.2f", heading);
+ fltRules = rec->getAircraft()->getTrafficRef()->getFlightRules();
+ transponderCode = genTransponderCode(fltRules);
+ rec->getAircraft()->SetTransponderCode(transponderCode);
text = receiver + ". Start-up approved. " + atisInformation + " correct, runway " + activeRunway
- + ", " + SID + ", squawk BBBB. " +
+ + ", " + SID + ", squawk " + transponderCode + ". " +
"For push-back and taxi clearance call " + taxiFreqStr + ". " + sender + " control.";
break;
case MSG_DENY_ENGINE_START:
}
taxiFreqStr = formatATCFrequency3_2(taxiFreq);
activeRunway = rec->getAircraft()->GetFlightPlan()->getRunway();
+ transponderCode = rec->getAircraft()->GetTransponderCode();
text = receiver + ". Start-up approved. " + atisInformation + " correct, runway " +
- activeRunway + ", " + SID + ", squawk BBBB. " +
+ activeRunway + ", " + SID + ", squawk " + transponderCode + ". " +
"For push-back and taxi clearance call " + taxiFreqStr + ". " + sender;
break;
default:
return string(buffer);
}
+string FGATCController::genTransponderCode(string fltRules) {
+ if (fltRules == "VFR") {
+ return string("1200");
+ } else {
+ char buffer[5];
+ snprintf(buffer, 5, "%d%d%d%d", rand() % 8, rand() % 8,rand() % 8, rand() % 8);
+ return string(buffer);
+ }
+}
+
/***************************************************************************
* class FGTowerController
*