]> git.mxchange.org Git - flightgear.git/blobdiff - src/ATC/ground.hxx
This innocuous looking typo was crashing the sim whenever an AI plane was asked to...
[flightgear.git] / src / ATC / ground.hxx
index 4ec09fca83bda6b5e49eb7d0b76f4afdbab352c0..318191c82668f66c80699710a1cf45f9a409ed04 100644 (file)
@@ -16,7 +16,7 @@
 //
 // You should have received a copy of the GNU General Public License
 // along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
 #ifndef _FG_GROUND_HXX
 #define _FG_GROUND_HXX
@@ -211,13 +211,9 @@ struct GRunwayDetails {
        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*
-       int ID;         // 1 -> 36
        string rwyID;
-       // Do we really need *both* the last two??
 };
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -229,22 +225,19 @@ class FGGround : public FGATC {
 
 public:
        FGGround();
-       FGGround(string id);
+       FGGround(const string& id);
        ~FGGround();
     void Init();
 
     void Update(double dt);
        
-       inline string get_trans_ident() { return trans_ident; }
-       inline atc_type GetType() { return GROUND; }
-    inline void SetDisplay() {display = true;}
-    inline void SetNoDisplay() {display = false;}
+       inline const string& get_trans_ident() { return trans_ident; }
 
     // Contact ground control on arrival, assumed to request any gate
     //void NewArrival(plane_rec plane);
 
     // Contact ground control on departure, assumed to request currently active runway.
-    void RequestDeparture(PlaneRec plane, FGAIEntity* requestee);
+    void RequestDeparture(const PlaneRec& plane, FGAIEntity* requestee);
 
     // Contact ground control when the calling routine doesn't know if arrival
     // or departure is appropriate.
@@ -262,24 +255,28 @@ public:
        // Return a pointer to an unused gate
        Gate* GetGateNode();
        
+       // Return a pointer to a hold short node
+       node* GetHoldShortNode(const string& rwyID);
+       
        // Runway stuff - this might change in the future.
        // Get a list of exits from a given runway
        // It is up to the calling function to check for non-zero size of returned array before use
-       node_array_type GetExits(string rwyID);
+       node_array_type GetExits(const string& rwyID);
        
        // Get a path from one node to another
        ground_network_path_type GetPath(node* A, node* B);
        
        // Get a path from a node to a runway threshold
-       ground_network_path_type GetPath(node* A, string rwyID);
+       ground_network_path_type GetPath(node* A, const string& rwyID);
        
        // Get a path from a node to a runway hold short point
        // Bit of a hack this at the moment!
-       ground_network_path_type GetPathToHoldShort(node* A, string rwyID);
+       ground_network_path_type GetPathToHoldShort(node* A, const string& rwyID);
 
 private:
-       // Tower stuff
-
+       FGATCMgr* ATCmgr;       
+       // This is purely for synactic convienience to avoid writing globals->get_ATC_mgr()-> all through the code!
+       
     // Need a data structure to hold details of the various active planes
     // Need a data structure to hold details of the logical network
     // including which gates are filled - or possibly another data structure
@@ -295,10 +292,6 @@ private:
        // A map of all the gates indexed against internal (FGFS) ID
        gate_map_type gates;
        gate_map_iterator gatesItr;
-       
-       // Runway stuff - this might change in the future.
-       //runway_array_type runways;    // STL way
-       Rwy runways[36];        // quick hack!
 
        FGATCAlignedProjection ortho;
        
@@ -314,13 +307,34 @@ private:
     // Generate the next clearance for an airplane
     //NextClearance(ground_rec &g);
        
-       bool display;           // Flag to indicate whether we should be outputting to the ATC display.
-       bool displaying;                // Flag to indicate whether we are outputting to the ATC display.
+       // environment - need to make sure we're getting the surface winds and not winds aloft.
+       SGPropertyNode* wind_from_hdg;  //degrees
+       SGPropertyNode* wind_speed_knots;               //knots
+       
        // for failure modeling
        string trans_ident;             // transmitted ident
        bool ground_failed;             // ground failed?
        bool networkLoadOK;             // Indicates whether LoadNetwork returned true or false at last attempt
        
+       // Tower control
+       bool untowered;         // True if this is an untowered airport (we still need the ground class for shortest path implementation etc
+       //FGATC* tower;         // Pointer to the tower control
+
+       // Logical runway details - this might change in the future.
+       //runway_array_type runways;    // STL way
+       Rwy runways[37];        // quick hack!
+       
+       // Physical runway details
+       double aptElev;         // Airport elevation
+       string activeRwy;       // Active runway number - For now we'll disregard multiple / alternate runway operation.
+       RunwayDetails rwy;      // Assumed to be the active one for now.// Figure out which runways are active.
+       
+       // For now we'll just be simple and do one active runway - eventually this will get much more complex
+       // Copied from FGTower - TODO - it would be better to implement this just once, and have ground call tower
+       // for runway operation details, but at the moment we can't guarantee that tower control at a given airport
+       // will be initialised before ground so we can't do that.
+       void DoRwyDetails();    
+       
        // Load the logical ground network for this airport from file.
        // Return true if successfull.
        bool LoadNetwork();
@@ -337,7 +351,7 @@ private:
        
        // Return a pointer to the node at a runway threshold
        // Returns NULL if unsuccessful.
-       node* GetThresholdNode(string rwyID);
+       node* GetThresholdNode(const string& rwyID);
        
        // A shortest path algorithm from memory (I can't find the bl&*dy book again!)
        ground_network_path_type GetShortestPath(node* A, node* B);