]> git.mxchange.org Git - flightgear.git/blobdiff - src/AIModel/AIBase.hxx
Roy Vegard Ovesen:
[flightgear.git] / src / AIModel / AIBase.hxx
index 568469542cccc699fc5500b6c1847a07b4719cbd..44ebd61e83559af3fe0d4de1d303bde93bb996ed 100644 (file)
@@ -30,6 +30,8 @@
 
 SG_USING_STD(string);
 
+class FGAIManager;
+
 class FGAIBase {
 
 public:
@@ -39,6 +41,9 @@ public:
     virtual void update(double dt);
     inline Point3D GetPos() { return(pos); }
 
+    enum object_type { otNull, otAircraft, otShip, otBallistic,
+                       otRocket, otStorm, otThermal };
+
     virtual bool init();
     virtual void bind();
     virtual void unbind();
@@ -51,21 +56,26 @@ public:
     void setLongitude( double longitude );
     void setBank( double bank );
 
+    void setID( int ID );
+    int  getID();
     void setDie( bool die );
     bool getDie();
 
 protected:
 
     SGPropertyNode *props;
+    FGAIManager* manager;
 
+    // these describe the model's actual state
     Point3D pos;       // WGS84 lat & lon in degrees, elev above sea-level in meters
     double hdg;                // True heading in degrees
     double roll;       // degrees, left is negative
     double pitch;      // degrees, nose-down is negative
     double speed;       // knots true airspeed
     double altitude;    // meters above sea level
-    double vs;           // vertical speed, feet per minute   
+    double vs;          // vertical speed, feet per minute   
 
+    // these describe the model's desired state
     double tgt_heading;  // target heading, degrees true
     double tgt_altitude; // target altitude, *feet* above sea level
     double tgt_speed;    // target speed, KTAS
@@ -74,15 +84,29 @@ protected:
     double tgt_yaw;
     double tgt_vs;
 
+    // these describe radar information for the user
+    double bearing;      // true bearing from user to this model
+    double elevation;    // elevation in degrees from user to this model
+    double range;        // range from user to this model, nm
+    double rdot;         // range rate, in knots
+    double horiz_offset; // look left/right from user to me, deg
+    double vert_offset;  // look up/down from user to me, deg
+    double x_shift;      // value used by radar display instrument
+    double y_shift;      // value used by radar display instrument
+    double rotation;     // value used by radar display instrument
+
 
     string model_path;    //Path to the 3D model
     SGModelPlacement aip;
     bool delete_me;
+    int id;
+    bool invisible;
 
     void Transform();
 
     static FGAIBase *_self;
     const char *_type_str;
+    object_type _otype;
 
 public:
 
@@ -98,7 +122,18 @@ public:
     static double _getLongitude();
     static double _getLatitude ();
 
+    static double _getBearing();
+    static double _getElevation();
+    static double _getRange();
+    static double _getRdot();
+    static double _getH_offset();
+    static double _getV_offset();
+    static double _getX_shift();
+    static double _getY_shift();
+    static double _getRotation();
+
     static bool _isNight();
+    bool isa( object_type otype );
 };
 
 
@@ -143,6 +178,16 @@ inline void FGAIBase::_setLatitude ( double latitude )  {
 inline double FGAIBase::_getLongitude() { return _self->pos.lon(); }
 inline double FGAIBase::_getLatitude () { return _self->pos.lat(); }
 
+inline double FGAIBase::_getBearing()   { return _self->bearing; }
+inline double FGAIBase::_getElevation() { return _self->elevation; }
+inline double FGAIBase::_getRange()     { return _self->range; }
+inline double FGAIBase::_getRdot()      { return _self->rdot; }
+inline double FGAIBase::_getH_offset()  { return _self->horiz_offset; }
+inline double FGAIBase::_getV_offset()  { return _self->vert_offset; }
+inline double FGAIBase::_getX_shift()   { return _self->x_shift; }
+inline double FGAIBase::_getY_shift()   { return _self->y_shift; }
+inline double FGAIBase::_getRotation()  { return _self->rotation; }
+
 inline double FGAIBase::_getVS_fps() { return _self->vs*60.0; }
 inline void FGAIBase::_setVS_fps( double _vs ) { _self->vs = _vs/60.0; }
 
@@ -157,5 +202,8 @@ inline bool FGAIBase::_isNight() {
     return (fgGetFloat("/sim/time/sun-angle-rad") > 1.57);
 }
 
+inline void FGAIBase::setID( int ID ) { id = ID; }
+inline int  FGAIBase::getID() { return id; }
+
 #endif  // _FG_AIBASE_HXX