]> git.mxchange.org Git - flightgear.git/blobdiff - src/ATC/AIEntity.cxx
The most important part is that it fixes possible
[flightgear.git] / src / ATC / AIEntity.cxx
index 2b333cfdbae1593c33c6a8c3be373ab003d8cdad..efcaaee1cc56ce05be481d4185e32cf26939baf8 100644 (file)
@@ -21,7 +21,7 @@
 /*****************************************************************
 *
 * WARNING - Curt has some ideas about AI traffic so anything in here
-* may get rewritten or scrapped.  Contact Curt curt@flightgear.org 
+* may get rewritten or scrapped.  Contact Curt http://www.flightgear.org/~curt 
 * before spending any time or effort on this code!!!
 *
 ******************************************************************/
 
 #include "AIEntity.hxx"
 
+FGAIEntity::FGAIEntity() {
+}
+
 FGAIEntity::~FGAIEntity() {
+       //cout << "FGAIEntity dtor called..." << endl;
+        ssgDeRefDelete(_model);        // Ought to check valid?
+       //cout << "Removing model from scene graph..." << endl;
+       globals->get_scenery()->get_scene_graph()->removeKid(_aip.getSceneGraph());
+        // Unregister that one at the scenery manager
+        globals->get_scenery()->unregister_placement_transform(_aip.getTransform());
+
+       //cout << "Done!" << endl;
+}
+
+void FGAIEntity::SetModel(ssgBranch* model) {
+       _model = model;
+       _model->ref();
+       _aip.init(_model);
+       _aip.setVisible(false);
+       globals->get_scenery()->get_scene_graph()->addKid(_aip.getSceneGraph());
+        // Register that one at the scenery manager
+        globals->get_scenery()->register_placement_transform(_aip.getTransform());
+
 }
 
 void FGAIEntity::Update(double dt) {
 }
 
+const string &FGAIEntity::GetCallsign() {
+       static string s = "";
+       return(s);
+}
+
 void FGAIEntity::RegisterTransmission(int code) {
 }
 
 // Run the internal calculations
 //void FGAIEntity::Update() {
 void FGAIEntity::Transform() {
-    aip.setPosition(pos.lon(), pos.lat(), pos.elev() * SG_METER_TO_FEET);
-    aip.setOrientation(roll, pitch, hdg);
-    aip.update( globals->get_scenery()->get_center() );    
+    _aip.setPosition(_pos.lon(), _pos.lat(), _pos.elev() * SG_METER_TO_FEET);
+    _aip.setOrientation(_roll, _pitch, _hdg);
+    _aip.update();    
 }