1 // FGAIEntity - abstract base class an artificial intelligence entity
3 // Written by David Luff, started March 2002.
5 // Copyright (C) 2002 David C. Luff - david.luff@nottingham.ac.uk
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 /*****************************************************************
23 * WARNING - Curt has some ideas about AI traffic so anything in here
24 * may get rewritten or scrapped. Contact Curt http://www.flightgear.org/~curt
25 * before spending any time or effort on this code!!!
27 ******************************************************************/
33 #include <Main/globals.hxx>
34 #include <Scenery/scenery.hxx>
35 #include <simgear/constants.h>
36 #include <simgear/math/point3d.hxx>
37 #include <simgear/math/sg_geodesy.hxx>
38 #include <simgear/misc/sg_path.hxx>
41 #include "AIEntity.hxx"
43 FGAIEntity::FGAIEntity() {
46 FGAIEntity::~FGAIEntity() {
47 //cout << "FGAIEntity dtor called..." << endl;
48 //cout << "Removing model from scene graph..." << endl;
49 globals->get_scenery()->get_scene_graph()->removeKid(_aip.getSceneGraph());
50 // Unregister that one at the scenery manager
51 globals->get_scenery()->unregister_placement_transform(_aip.getTransform());
53 //cout << "Done!" << endl;
56 void FGAIEntity::SetModel(ssgBranch* model) {
59 _aip.setVisible(false);
60 globals->get_scenery()->get_scene_graph()->addKid(_aip.getSceneGraph());
61 // Register that one at the scenery manager
62 globals->get_scenery()->register_placement_transform(_aip.getTransform());
66 void FGAIEntity::Update(double dt) {
69 const string &FGAIEntity::GetCallsign() {
74 void FGAIEntity::RegisterTransmission(int code) {
77 // Run the internal calculations
78 //void FGAIEntity::Update() {
79 void FGAIEntity::Transform() {
80 _aip.setPosition(_pos.lon(), _pos.lat(), _pos.elev() * SG_METER_TO_FEET);
81 _aip.setOrientation(_roll, _pitch, _hdg);