2002-04-03 23:54:44 +00:00
|
|
|
// FGAIEntity - abstract base class an artificial intelligence entity
|
|
|
|
//
|
|
|
|
// Written by David Luff, started March 2002.
|
|
|
|
//
|
|
|
|
// Copyright (C) 2002 David C. Luff - david.luff@nottingham.ac.uk
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License as
|
|
|
|
// published by the Free Software Foundation; either version 2 of the
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful, but
|
|
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// General Public License for more details.
|
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
|
|
|
|
/*****************************************************************
|
|
|
|
*
|
|
|
|
* WARNING - Curt has some ideas about AI traffic so anything in here
|
|
|
|
* may get rewritten or scrapped. Contact Curt curt@flightgear.org
|
|
|
|
* before spending any time or effort on this code!!!
|
|
|
|
*
|
|
|
|
******************************************************************/
|
|
|
|
|
2002-12-03 14:59:24 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
2002-04-03 23:54:44 +00:00
|
|
|
#include <Main/globals.hxx>
|
|
|
|
#include <Scenery/scenery.hxx>
|
2003-12-19 02:42:32 +00:00
|
|
|
#include <simgear/constants.h>
|
2002-04-03 23:54:44 +00:00
|
|
|
#include <simgear/math/point3d.hxx>
|
|
|
|
#include <simgear/math/sg_geodesy.hxx>
|
|
|
|
#include <simgear/misc/sg_path.hxx>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include "AIEntity.hxx"
|
|
|
|
|
2004-01-23 17:18:24 +00:00
|
|
|
FGAIEntity::FGAIEntity() {
|
|
|
|
}
|
|
|
|
|
2002-04-03 23:54:44 +00:00
|
|
|
FGAIEntity::~FGAIEntity() {
|
2004-01-23 17:18:24 +00:00
|
|
|
//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());
|
|
|
|
//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());
|
2002-04-03 23:54:44 +00:00
|
|
|
}
|
|
|
|
|
2002-10-02 15:27:49 +00:00
|
|
|
void FGAIEntity::Update(double dt) {
|
|
|
|
}
|
|
|
|
|
2004-01-23 17:18:24 +00:00
|
|
|
string FGAIEntity::GetCallsign() {
|
|
|
|
return("");
|
|
|
|
}
|
|
|
|
|
2003-03-20 11:53:44 +00:00
|
|
|
void FGAIEntity::RegisterTransmission(int code) {
|
|
|
|
}
|
|
|
|
|
2002-04-03 23:54:44 +00:00
|
|
|
// Run the internal calculations
|
2002-10-02 15:27:49 +00:00
|
|
|
//void FGAIEntity::Update() {
|
|
|
|
void FGAIEntity::Transform() {
|
2004-01-23 17:18:24 +00:00
|
|
|
_aip.setPosition(_pos.lon(), _pos.lat(), _pos.elev() * SG_METER_TO_FEET);
|
|
|
|
_aip.setOrientation(_roll, _pitch, _hdg);
|
|
|
|
_aip.update( globals->get_scenery()->get_center() );
|
2002-04-03 23:54:44 +00:00
|
|
|
}
|