1 // AIMgr.hxx - definition of FGAIMgr
2 // - a global management class for FlightGear generated AI traffic
4 // Written by David Luff, started March 2002.
6 // Copyright (C) 2002 David C Luff - david.luff@nottingham.ac.uk
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License as
10 // published by the Free Software Foundation; either version 2 of the
11 // License, or (at your option) any later version.
13 // This program is distributed in the hope that it will be useful, but
14 // WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 // General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 #include <simgear/structure/subsystem_mgr.hxx>
27 #include <Main/fg_props.hxx>
32 #include "AIEntity.hxx"
37 class FGAIMgr : public SGSubsystem
42 // This is purely for synactic convienience to avoid writing globals->get_ATC_mgr()-> all through the code!
44 // A list of pointers to all currently active AI stuff
45 typedef list <FGAIEntity*> ai_list_type;
46 typedef ai_list_type::iterator ai_list_iterator;
47 typedef ai_list_type::const_iterator ai_list_const_iterator;
49 // Everything put in this list should be created dynamically
50 // on the heap and ***DELETED WHEN REMOVED!!!!!***
52 ai_list_iterator ai_list_itr;
53 // Any member function of FGATCMgr is permitted to leave this iterator pointing
54 // at any point in or at the end of the list.
55 // Hence any new access must explicitly first check for atc_list.end() before dereferencing.
57 // A list of airport ID's
58 typedef list < string > aptID_list_type;
59 typedef aptID_list_type::iterator aptID_list_iterator;
61 // A map of airport-IDs that have taxiway network files against bucket number
62 typedef map < int, aptID_list_type* > ai_apt_map_type;
63 typedef ai_apt_map_type::iterator ai_apt_map_iterator;
64 ai_apt_map_type airports;
66 // A map of airport ID's that we've activated AI traffic at
67 typedef map < string, int > ai_activated_map_type;
68 typedef ai_activated_map_type::iterator ai_activated_map_iterator;
69 ai_activated_map_type activated;
71 // Position of the Users Aircraft
75 // Pointers to current users position
76 SGPropertyNode *lon_node;
77 SGPropertyNode *lat_node;
78 SGPropertyNode *elev_node;
91 void update(double dt);
95 bool initDone; // Hack - guard against update getting called before init
97 // Remove a class from the ai_list and delete it from memory
98 //void RemoveFromList(const char* id, atc_type tp);
100 // Activate AI traffic at an airport
101 void ActivateAirport(string id);
103 // Search for valid airports in the vicinity of the user and activate them if necessary
104 void SearchByPos(double range);
108 #endif // _FG_AIMGR_HXX