1 // AIManager.hxx - David Culp - based on:
2 // AIMgr.hxx - definition of FGAIMgr
3 // - a global management class for FlightGear generated AI traffic
5 // Written by David Luff, started March 2002.
7 // Copyright (C) 2002 David C Luff - david.luff@nottingham.ac.uk
9 // This program is free software; you can redistribute it and/or
10 // modify it under the terms of the GNU General Public License as
11 // published by the Free Software Foundation; either version 2 of the
12 // License, or (at your option) any later version.
14 // This program is distributed in the hope that it will be useful, but
15 // WITHOUT ANY WARRANTY; without even the implied warranty of
16 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 // General Public License for more details.
19 // You should have received a copy of the GNU General Public License
20 // along with this program; if not, write to the Free Software
21 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 #ifndef _FG_AIMANAGER_HXX
24 #define _FG_AIMANAGER_HXX
28 #include <simgear/structure/subsystem_mgr.hxx>
29 #include <simgear/structure/SGSharedPtr.hxx>
31 #include <Main/fg_props.hxx>
33 #include <AIModel/AIBase.hxx>
34 #include <AIModel/AIFlightPlan.hxx>
36 #include <Traffic/SchedFlight.hxx>
37 #include <Traffic/Schedule.hxx>
43 class FGAIManager : public SGSubsystem
48 // A list of pointers to AI objects
49 typedef list <SGSharedPtr<FGAIBase> > ai_list_type;
50 typedef ai_list_type::iterator ai_list_iterator;
51 typedef ai_list_type::const_iterator ai_list_const_iterator;
55 inline const list <SGSharedPtr<FGAIBase> >& get_ai_list() const { return ai_list; }
65 void update(double dt);
67 void attach(SGSharedPtr<FGAIBase> model);
69 void destroyObject( int ID );
71 inline double get_user_latitude() const { return user_latitude; }
72 inline double get_user_longitude() const { return user_longitude; }
73 inline double get_user_altitude() const { return user_altitude; }
74 inline double get_user_heading() const { return user_heading; }
75 inline double get_user_pitch() const { return user_pitch; }
76 inline double get_user_yaw() const { return user_yaw; }
77 inline double get_user_speed() const {return user_speed; }
78 inline double get_wind_from_east() const {return wind_from_east; }
79 inline double get_wind_from_north() const {return wind_from_north; }
81 int getNumAiObjects(void) const;
83 void processScenario( const string &filename );
85 static SGPropertyNode_ptr loadScenarioFile(const std::string& filename);
87 static bool getStartPosition(const string& id, const string& pid,
88 SGGeod& geodPos, double& hdng, SGVec3d& uvw);
93 int mNumAiTypeModels[FGAIBase::MAX_OBJECTS];
96 SGPropertyNode_ptr root;
97 SGPropertyNode_ptr wind_from_down_node;
98 SGPropertyNode_ptr user_latitude_node;
99 SGPropertyNode_ptr user_longitude_node;
100 SGPropertyNode_ptr user_altitude_node;
101 SGPropertyNode_ptr user_heading_node;
102 SGPropertyNode_ptr user_pitch_node;
103 SGPropertyNode_ptr user_yaw_node;
104 SGPropertyNode_ptr user_speed_node;
105 SGPropertyNode_ptr wind_from_east_node ;
106 SGPropertyNode_ptr wind_from_north_node ;
108 string scenario_filename;
110 double user_latitude;
111 double user_longitude;
112 double user_altitude;
117 double wind_from_east;
118 double wind_from_north;
120 void fetchUserState( void );
123 double range_nearest;
125 void processThermal( FGAIThermal* thermal );
129 #endif // _FG_AIMANAGER_HXX