1 // AIMgr.cxx - implementation 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.
22 #include <Main/fgfs.hxx>
23 #include <Main/fg_props.hxx>
28 #include "AILocalTraffic.hxx"
39 void FGAIMgr::init() {
40 // Hard wire some local traffic for now.
41 // This is regardless of location and hence *very* ugly but it is a start.
42 FGAILocalTraffic* local_traffic = new FGAILocalTraffic;
43 //local_traffic->Init("KEMT", IN_PATTERN, TAKEOFF_ROLL);
44 local_traffic->Init("KEMT");
45 local_traffic->FlyCircuits(1, true); // Fly 2 circuits with touch & go in between
46 ai_list.push_back(local_traffic);
49 void FGAIMgr::bind() {
52 void FGAIMgr::unbind() {
55 void FGAIMgr::update(double dt) {
56 // Don't update any planes for first 50 runs through - this avoids some possible initialisation anomalies
63 // Traverse the list of active planes and run all their update methods
64 // TODO - spread the load - not all planes should need updating every frame.
65 // Note that this will require dt to be calculated for each plane though
66 // since they rely on it to calculate distance travelled.
67 ai_list_itr = ai_list.begin();
68 while(ai_list_itr != ai_list.end()) {
69 (*ai_list_itr)->Update(dt);