diff --git a/src/AIModel/AIAircraft.cxx b/src/AIModel/AIAircraft.cxx index 762240247..2ad2b489d 100644 --- a/src/AIModel/AIAircraft.cxx +++ b/src/AIModel/AIAircraft.cxx @@ -96,6 +96,7 @@ FGAIAircraft::FGAIAircraft(FGAISchedule *ref) : takeOffStatus = 0; trackCache.remainingLength = 0; + trackCache.startWptName = "-"; } @@ -631,7 +632,7 @@ void FGAIAircraft::scheduleForATCTowerDepartureControl(int state) { // Process ATC instructions and report back -void FGAIAircraft::processATC(FGATCInstruction instruction) { +void FGAIAircraft::processATC(const FGATCInstruction& instruction) { if (instruction.getCheckForCircularWait()) { // This is not exactly an elegant solution, // but at least it gives me a chance to check diff --git a/src/AIModel/AIAircraft.hxx b/src/AIModel/AIAircraft.hxx index 3ce0d6283..3a149857f 100644 --- a/src/AIModel/AIAircraft.hxx +++ b/src/AIModel/AIAircraft.hxx @@ -73,7 +73,7 @@ public: void setCompany(const std::string& comp) { company = comp;}; void announcePositionToController(); //TODO have to be public? - void processATC(FGATCInstruction instruction); + void processATC(const FGATCInstruction& instruction); void setTaxiClearanceRequest(bool arg) { needsTaxiClearance = arg; }; bool getTaxiClearanceRequest() { return needsTaxiClearance; }; FGAISchedule * getTrafficRef() { return trafficRef; }; diff --git a/src/AIModel/AIFlightPlan.cxx b/src/AIModel/AIFlightPlan.cxx index 5e17a3d9a..f2e5421d7 100644 --- a/src/AIModel/AIFlightPlan.cxx +++ b/src/AIModel/AIFlightPlan.cxx @@ -447,7 +447,7 @@ int FGAIFlightPlan::getRouteIndex(int i) { return 0; } -double FGAIFlightPlan::checkTrackLength(const string& wptName) { +double FGAIFlightPlan::checkTrackLength(const string& wptName) const { // skip the first two waypoints: first one is behind, second one is partially done; double trackDistance = 0; wpt_vector_iterator wptvec = waypoints.begin(); @@ -471,7 +471,7 @@ void FGAIFlightPlan::shortenToFirst(unsigned int number, string name) (waypoints.back())->setName((waypoints.back())->getName() + name); } -void FGAIFlightPlan::setGate(ParkingAssignment pka) +void FGAIFlightPlan::setGate(const ParkingAssignment& pka) { gate = pka; } diff --git a/src/AIModel/AIFlightPlan.hxx b/src/AIModel/AIFlightPlan.hxx index 120e80851..7c9881ada 100644 --- a/src/AIModel/AIFlightPlan.hxx +++ b/src/AIModel/AIFlightPlan.hxx @@ -130,7 +130,7 @@ public: double getBearing(FGAIWaypoint* previous, FGAIWaypoint* next) const; double getBearing(const SGGeod& aPos, FGAIWaypoint* next) const; - double checkTrackLength(const std::string& wptName); + double checkTrackLength(const std::string& wptName) const; time_t getStartTime() const { return start_time; } time_t getArrivalTime() const { return arrivalTime; } @@ -173,7 +173,7 @@ public: void shortenToFirst(unsigned int number, std::string name); - void setGate(ParkingAssignment pka); + void setGate(const ParkingAssignment& pka); FGParking* getParkingGate(); private: diff --git a/src/ATC/trafficcontrol.cxx b/src/ATC/trafficcontrol.cxx index e475763f7..8d5c801fb 100644 --- a/src/ATC/trafficcontrol.cxx +++ b/src/ATC/trafficcontrol.cxx @@ -179,7 +179,9 @@ FGTrafficRecord::FGTrafficRecord(): allowTransmission(true), allowPushback(true), priority(0), - latitude(0), longitude(0), heading(0), speed(0), altitude(0), radius(0) + timer(0), + latitude(0), longitude(0), heading(0), speed(0), altitude(0), radius(0), + aircraft(NULL) { } @@ -413,7 +415,7 @@ bool FGTrafficRecord::isOpposing(FGGroundNetwork * net, return false; } -bool FGTrafficRecord::isActive(int margin) +bool FGTrafficRecord::isActive(int margin) const { time_t now = time(NULL) + fgGetLong("/sim/time/warp"); time_t deptime = aircraft->getTrafficRef()->getDepartureTime(); @@ -433,7 +435,7 @@ void FGTrafficRecord::setHeadingAdjustment(double heading) instruction.setHeading(heading); } -bool FGTrafficRecord::pushBackAllowed() +bool FGTrafficRecord::pushBackAllowed() const { return allowPushback; } @@ -460,7 +462,7 @@ FGATCInstruction::FGATCInstruction() } -bool FGATCInstruction::hasInstruction() +bool FGATCInstruction::hasInstruction() const { return (holdPattern || holdPosition || changeSpeed || changeHeading || changeAltitude || resolveCircularWait); @@ -481,6 +483,8 @@ FGATCController::FGATCController() available = true; lastTransmission = 0; initialized = false; + lastTransmissionDirection = ATC_AIR_TO_GROUND; + group = NULL; } FGATCController::~FGATCController() diff --git a/src/ATC/trafficcontrol.hxx b/src/ATC/trafficcontrol.hxx index 26d400015..3d58d5806 100644 --- a/src/ATC/trafficcontrol.hxx +++ b/src/ATC/trafficcontrol.hxx @@ -67,34 +67,34 @@ private: public: FGATCInstruction(); - bool hasInstruction (); - bool getHoldPattern () { + bool hasInstruction () const; + bool getHoldPattern () const { return holdPattern; }; - bool getHoldPosition () { + bool getHoldPosition () const { return holdPosition; }; - bool getChangeSpeed () { + bool getChangeSpeed () const { return changeSpeed; }; - bool getChangeHeading () { + bool getChangeHeading () const { return changeHeading; }; - bool getChangeAltitude() { + bool getChangeAltitude() const { return changeAltitude; }; - double getSpeed () { + double getSpeed () const { return speed; }; - double getHeading () { + double getHeading () const { return heading; }; - double getAlt () { + double getAlt () const { return alt; }; - bool getCheckForCircularWait() { + bool getCheckForCircularWait() const { return resolveCircularWait; }; @@ -192,34 +192,34 @@ public: int crosses (FGGroundNetwork *, FGTrafficRecord &other); bool isOpposing (FGGroundNetwork *, FGTrafficRecord &other, int node); - bool isActive(int margin); + bool isActive(int margin) const; bool onRoute(FGGroundNetwork *, FGTrafficRecord &other); - bool getSpeedAdjustment() { + bool getSpeedAdjustment() const { return instruction.getChangeSpeed(); }; - double getLatitude () { + double getLatitude () const { return latitude ; }; - double getLongitude() { + double getLongitude() const { return longitude; }; - double getHeading () { + double getHeading () const { return heading ; }; - double getSpeed () { + double getSpeed () const { return speed ; }; - double getAltitude () { + double getAltitude () const { return altitude ; }; - double getRadius () { + double getRadius () const { return radius ; }; - int getWaitsForId () { + int getWaitsForId () const { return waitsForId; }; @@ -232,10 +232,10 @@ public: instruction.setChangeHeading(false); }; - bool hasHeadingAdjustment() { + bool hasHeadingAdjustment() const { return instruction.getChangeHeading(); }; - bool hasHoldPosition() { + bool hasHoldPosition() const { return instruction.getHoldPosition(); }; void setHoldPosition (bool inst) { @@ -253,7 +253,7 @@ public: instruction.setResolveCircularWait(false); }; - const std::string& getRunway() { + const std::string& getRunway() const { return runway; }; //void setCallSign(string clsgn) { callsign = clsgn; }; @@ -265,21 +265,21 @@ public: allowTransmission=true; }; //string getCallSign() { return callsign; }; - FGAIAircraft *getAircraft() { + FGAIAircraft *getAircraft() const { return aircraft; }; - int getTime() { + int getTime() const { return timer; }; - int getLeg() { + int getLeg() const { return leg; }; void setTime(time_t time) { timer = time; }; - bool pushBackAllowed(); - bool allowTransmissions() { + bool pushBackAllowed() const; + bool allowTransmissions() const { return allowTransmission; }; void allowPushBack() { allowPushback =true;}; @@ -293,17 +293,17 @@ public: void nextFrequency() { frequencyId++; }; - int getNextFrequency() { + int getNextFrequency() const { return frequencyId; }; intVec& getIntentions() { return intentions; }; - int getCurrentPosition() { + int getCurrentPosition() const { return currentPos; }; void setPriority(int p) { priority = p; }; - int getPriority() { return priority; }; + int getPriority() const { return priority; }; }; typedef std::list TrafficVector; diff --git a/src/Traffic/SchedFlight.cxx b/src/Traffic/SchedFlight.cxx index 6ca4ed0a6..784c1443a 100644 --- a/src/Traffic/SchedFlight.cxx +++ b/src/Traffic/SchedFlight.cxx @@ -79,6 +79,8 @@ FGScheduledFlight::FGScheduledFlight() repeatPeriod = 0; initialized = false; available = true; + departurePort = NULL; + arrivalPort = NULL; } FGScheduledFlight::FGScheduledFlight(const FGScheduledFlight &other)