]> git.mxchange.org Git - flightgear.git/blobdiff - src/ATC/AIEntity.cxx
Modified Files:
[flightgear.git] / src / ATC / AIEntity.cxx
index 9dccebea01911ec734d2d84c3c6fa884eb23634f..41baf4a05eebb9c597cdb9222e161e5ec9974fea 100644 (file)
@@ -16,7 +16,7 @@
 //
 // You should have received a copy of the GNU General Public License
 // along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
 /*****************************************************************
 *
@@ -45,25 +45,26 @@ FGAIEntity::FGAIEntity() {
 
 FGAIEntity::~FGAIEntity() {
        //cout << "FGAIEntity dtor called..." << endl;
-       _model->deRef();        // Ought to check valid?
        //cout << "Removing model from scene graph..." << endl;
-       globals->get_scenery()->get_scene_graph()->removeKid(_aip.getSceneGraph());
+       globals->get_scenery()->get_scene_graph()->removeChild(_aip.getSceneGraph());
+
        //cout << "Done!" << endl;
 }
 
-void FGAIEntity::SetModel(ssgBranch* model) {
+void FGAIEntity::SetModel(osg::Node* model) {
        _model = model;
-       _model->ref();
-       _aip.init(_model);
+       _aip.init(_model.get());
        _aip.setVisible(false);
-       globals->get_scenery()->get_scene_graph()->addKid(_aip.getSceneGraph());
+       globals->get_scenery()->get_scene_graph()->addChild(_aip.getSceneGraph());
+
 }
 
 void FGAIEntity::Update(double dt) {
 }
 
-string FGAIEntity::GetCallsign() {
-       return("");
+const string &FGAIEntity::GetCallsign() {
+       static string s = "";
+       return(s);
 }
 
 void FGAIEntity::RegisterTransmission(int code) {
@@ -74,5 +75,5 @@ void FGAIEntity::RegisterTransmission(int code) {
 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.update();    
 }