]> git.mxchange.org Git - flightgear.git/blobdiff - src/AIModel/AIManager.hxx
Clear chat messages when an aircraft becomes inactive in the property tree.
[flightgear.git] / src / AIModel / AIManager.hxx
index 4b6d4ef085fc2e05151877772dffb1d91f0e2d20..2bcd4a541b25248251540c3fc54cf3f7e7e57d74 100644 (file)
 #include <Traffic/Schedule.hxx>
 
 SG_USING_STD(list);
-SG_USING_STD(vector);
-
-class FGModelID
-{
-private:
-  osg::ref_ptr<osg::Node> model;
-  string path;
-public:
-  FGModelID(const string& pth, osg::Node* mdl) { path =pth; model=mdl;};
-  osg::Node* const getModelId() const { return model.get();};
-  const string & getPath() const { return path;};
-  int getNumRefs() const { return model->referenceCount(); };
-};
-
-typedef vector<FGModelID> ModelVec;
-typedef vector<FGModelID>::iterator ModelVecIterator;
 
 class FGAIThermal;
 
-
 class FGAIManager : public SGSubsystem
 {
 
-private:
+public:
 
     // A list of pointers to AI objects
     typedef list <SGSharedPtr<FGAIBase> > ai_list_type;
@@ -68,22 +51,25 @@ private:
     typedef ai_list_type::const_iterator ai_list_const_iterator;
 
     ai_list_type ai_list;
-  ModelVec loadedModels;
 
-public:
+    inline const list <SGSharedPtr<FGAIBase> >& get_ai_list() const {
+        SG_LOG(SG_GENERAL, SG_DEBUG, "AI Manager: AI model return list size " << ai_list.size());
+        return ai_list;
+    }
 
     FGAIManager();
     ~FGAIManager();
 
     void init();
+    void postinit();
     void reinit();
     void bind();
     void unbind();
     void update(double dt);
-
     void attach(SGSharedPtr<FGAIBase> model);
 
     void destroyObject( int ID );
+    const FGAIBase *calcCollision(double alt, double lat, double lon, double fuse_range);
 
     inline double get_user_latitude() const { return user_latitude; }
     inline double get_user_longitude() const { return user_longitude; }
@@ -99,9 +85,6 @@ public:
 
     void processScenario( const string &filename );
 
-  osg::Node* getModel(const string& path);
-  void setModel(const string& path, osg::Node *model);
-
   static SGPropertyNode_ptr loadScenarioFile(const std::string& filename);
 
   static bool getStartPosition(const string& id, const string& pid,
@@ -113,6 +96,8 @@ private:
     int mNumAiTypeModels[FGAIBase::MAX_OBJECTS];
     int mNumAiModels;
 
+    double calcRange(double lat, double lon, double lat2, double lon2)const;
+
     SGPropertyNode_ptr root;
     SGPropertyNode_ptr wind_from_down_node;
     SGPropertyNode_ptr user_latitude_node;
@@ -122,10 +107,8 @@ private:
     SGPropertyNode_ptr user_pitch_node;
     SGPropertyNode_ptr user_yaw_node;
     SGPropertyNode_ptr user_speed_node;
-    SGPropertyNode_ptr wind_from_east_node ;
-    SGPropertyNode_ptr wind_from_north_node ;
-
-    string scenario_filename;
+    SGPropertyNode_ptr wind_from_east_node;
+    SGPropertyNode_ptr wind_from_north_node;
 
     double user_latitude;
     double user_longitude;
@@ -137,6 +120,7 @@ private:
     double wind_from_east;
     double wind_from_north;
     double _dt;
+
     void fetchUserState( void );
 
     // used by thermals