//#include "ATCmgr.hxx"
#include "ground.hxx"
#include "ATCProjection.hxx"
+#include "AIPlane.hxx"
//DCL - a complete guess for now.
#define FG_TOWER_DEFAULT_RANGE 30
CIRCUIT,
INBOUND,
OUTBOUND,
+ TTT_UNKNOWN, // departure, but we don't know if for circuits or leaving properly
STRAIGHT_IN
// Umm - what's the difference between INBOUND and STRAIGHT_IN ?
};
-// Much simplified compared to AILocalTraffic
-enum TwrPatternLeg {
- TWR_LANDING_ROLL,
- TWR_FINAL,
- TWR_BASE,
- TWR_DOWNWIND,
- TWR_CROSSWIND,
- TWR_CLIMBOUT,
- TWR_TAKEOFF_ROLL,
- TWR_UNKNOWN
-};
-
-// perhaps we could use an FGRunway instead of this
-struct RunwayDetails {
- Point3D threshold_pos;
- Point3D end1ortho; // ortho projection end1 (the threshold ATM)
- Point3D end2ortho; // ortho projection end2 (the take off end in the current hardwired scheme)
- //double mag_hdg;
- //double mag_var;
- double hdg; // true runway heading
- double length; // In *METERS*
- string rwyID;
-};
-
// Structure for holding details of a plane under tower control.
// Not fixed yet - may include more stuff later.
class TowerPlaneRec {
TowerPlaneRec(Point3D pt);
TowerPlaneRec(PlaneRec p, Point3D pt);
- FGAIEntity* planePtr; // This might move to the planeRec eventually
+ FGAIPlane* planePtr; // This might move to the planeRec eventually
PlaneRec plane;
Point3D pos;
tower_traffic_type opType;
// Whereabouts in circuit if doing circuits
- TwrPatternLeg leg;
+ PatternLeg leg;
bool isUser; // true if this plane is the user
};
void ReportRunwayVacated(string ID);
void ReportReadyForDeparture(string ID);
- // Contact tower when at a hold short for departure
- void ContactAtHoldShort(PlaneRec plane, FGAIEntity* requestee, tower_traffic_type operation);
+ // Contact tower when at a hold short for departure - for now we'll assume plane - maybe vehicles might want to cross runway eventually?
+ void ContactAtHoldShort(PlaneRec plane, FGAIPlane* requestee, tower_traffic_type operation);
// Public interface to the active runway - this will get more complex
// in the future and consider multi-runway use, airplane weight etc.
inline string GetActiveRunway() { return activeRwy; }
- inline RunwayDetails* GetActiveRunwayDetails() { return &rwy; }
+ inline RunwayDetails GetActiveRunwayDetails() { return rwy; }
inline void SetDisplay() { display = true; }
inline void SetNoDisplay() { display = false; }
inline atc_type GetType() { return TOWER; }
inline FGGround* GetGroundPtr() { return ground; }
+
+ // Returns true if positions of crosswind/downwind/base leg turns should be constrained by previous traffic
+ // plus the constraint position as a rwy orientated orthopos (meters)
+ bool GetCrosswindConstraint(double& cpos);
+ bool GetDownwindConstraint(double& dpos);
+ bool GetBaseConstraint(double& bpos);
private:
FGATCMgr* ATCmgr;
string trans_ident; // transmitted ident
bool tower_failed; // tower failed?
- // Pointers to current users position
- SGPropertyNode* user_lon_node;
- SGPropertyNode* user_lat_node;
- SGPropertyNode* user_elev_node;
+ // Pointers to current users position and orientation
+ SGPropertyNode* user_lon_node;
+ SGPropertyNode* user_lat_node;
+ SGPropertyNode* user_elev_node;
+ SGPropertyNode* user_hdg_node;
+
+ // Details of the general traffic flow etc in the circuit
+ double crosswind_leg_pos; // Distance from threshold crosswind leg is being turned to in meters (actual operation - *not* ideal circuit)
+ double downwind_leg_pos; // Actual offset distance in meters from the runway that planes are flying the downwind leg
+ // Currently not sure whether the above should be always +ve or just take the natural orthopos sign (+ve for RH circuit, -ve for LH).
+ double base_leg_pos; // Actual offset distance from the threshold (-ve) that planes are turning to base leg.
friend istream& operator>> ( istream&, FGTower& );
};