]> git.mxchange.org Git - flightgear.git/blobdiff - src/ATC/AIEntity.hxx
fix another crash on exit by finally converting the rest of unguarded
[flightgear.git] / src / ATC / AIEntity.hxx
index c7262c8f17ce27d137dd849e106914540c56fe1f..5c7f276bf09e8dadc6387f57ac0526b617592784 100644 (file)
 //
 // 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.
-
-/*****************************************************************
-*
-* WARNING - Curt has some ideas about AI traffic so anything in here
-* may get rewritten or scrapped.  Contact Curt curt@flightgear.org 
-* before spending any time or effort on this code!!!
-*
-******************************************************************/
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
 #ifndef _FG_AIEntity_HXX
 #define _FG_AIEntity_HXX
 
-#include <plib/sg.h>
-#include <plib/ssg.h>
 #include <simgear/math/point3d.hxx>
+#include <simgear/scene/model/model.hxx>
+#include <simgear/scene/model/placement.hxx>
+#include <simgear/structure/ssgSharedPtr.hxx>
 
+
+class ssgBase;
+
+
+/*****************************************************************
+*
+*  FGAIEntity - this class implements the minimum requirement
+*  for any AI entity - a position, an orientation, an associated
+*  3D model, and the ability to be moved.  It does nothing useful
+*  and all AI entities are expected to be derived from it.
+*
+******************************************************************/
 class FGAIEntity {
 
 public:
 
-    // We need some way for this class to display its radio transmissions if on the 
-    // same frequency and in the vicinity of the user's aircraft
-    // This may need to be done independently of ATC eg CTAF
-
+       FGAIEntity();
     virtual ~FGAIEntity();
+       
+       // Set the 3D model to use (Must be called)
+       void SetModel(ssgBranch* model);
 
     // Run the internal calculations
-    virtual void Update();
-
+    virtual void Update(double dt)=0;
+       
+    // Send a transmission *TO* the AIEntity.
+    // FIXME int code is a hack - eventually this will receive Alexander's coded messages.
+    virtual void RegisterTransmission(int code)=0;
+       
+       inline const Point3D& GetPos() const { return(_pos); }
+       
+       virtual const string& GetCallsign()=0;
+       
 protected:
 
-    double lat;                //WGS84
-    double lon;                //WGS84
-    double elev;       //Meters
-    double hdg;                //True heading in degrees
-    double roll;       //degrees
-    double pitch;      //degrees
+    Point3D _pos;      // WGS84 lat & lon in degrees, elev above sea-level in meters
+    double _hdg;               //True heading in degrees
+    double _roll;      //degrees
+    double _pitch;     //degrees
 
-    char* model_path;  //Path to the 3D model
-
-    ssgEntity* model;
-    ssgTransform* position;
+    char* _model_path; //Path to the 3D model
+    ssgSharedPtr<ssgBranch> _model;    // Pointer to the model
+    SGModelPlacement _aip;
 
     void Transform();
-
-    //void WorldCoordinate(sgCoord *obj_pos, Point3D center);
-
-    void FastWorldCoordinate(sgCoord *obj_pos, Point3D center);
-
 };
 
 #endif  // _FG_AIEntity_HXX