2004-09-22 08:47:05 +00:00
|
|
|
// FGAIScenario.cxx - class for loading an AI scenario
|
2004-05-15 09:07:55 +00:00
|
|
|
// Written by David Culp, started May 2004
|
|
|
|
// - davidculp2@comcast.net
|
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
|
2004-11-26 10:24:48 +00:00
|
|
|
#include <cstdio>
|
2004-05-15 09:07:55 +00:00
|
|
|
|
|
|
|
#include <simgear/misc/sg_path.hxx>
|
|
|
|
#include <simgear/debug/logstream.hxx>
|
|
|
|
#include <simgear/structure/exception.hxx>
|
|
|
|
#include <simgear/constants.h>
|
|
|
|
#ifdef __BORLANDC__
|
|
|
|
# define exception c_exception
|
|
|
|
#endif
|
|
|
|
#include <simgear/props/props.hxx>
|
2004-09-07 09:53:23 +00:00
|
|
|
|
2004-05-15 09:07:55 +00:00
|
|
|
#include <Main/globals.hxx>
|
|
|
|
#include <Main/fg_props.hxx>
|
|
|
|
|
2004-09-07 09:53:23 +00:00
|
|
|
#include "AIScenario.hxx"
|
2004-09-22 10:03:26 +00:00
|
|
|
#include "AIFlightPlan.hxx"
|
2004-09-07 09:53:23 +00:00
|
|
|
|
2004-11-26 10:24:48 +00:00
|
|
|
static list<string>
|
2005-03-19 09:57:18 +00:00
|
|
|
getAllStringNodeVals(const char* name, SGPropertyNode * entry_node);
|
Mathias Fröhlich:
I have introduced the posibility to start directly on the carrier.
With that patch you will have a --carrrier=id argument where id can either be
the pennant number configured in the nimitz scenario or the carriers name
also configured in the carriers scenario.
Additionaly you can use --parkpos=id to select different positions on the
carrier. They are also configured in the scenario file.
That includes the switch of the whole FGInterface class to make use of the
groundcache.
That means that an aircraft no longer uses the current elevation value from
the scenery class. It rather has its own local cache of the aircrafts
environment which is setup in the common_init method of FGInterface and
updated either manually by calling
FGInterface::get_groundlevel_m(lat, lon, alt_m);
or implicitly by calling the above method in the
FGInterface::_updateGeo*Position(lat, lon, alt);
methods.
A call get_groundlevel_m rebuilds the groundcache if the request is outside
the range of the cache.
Note that for the real usage of the groundcache including the correct
information about the movement of objects and the velocity information, you
still need to set up the groundcache in the usual way like YASim and JSBSim
currently does.
If you use the native interface, you will get only static objects correctly.
But for FDM's only using one single ground level for a whole step this is IMO
sufficient.
The AIManager gets a way to return the location of a object which is placed
wrt an AI Object. At the moment it only honours AICarriers for that.
That method is a static one, which loads the scenario file for that reason and
throws it away afterwards. This looked like the aprioriate way, because the
AIManager is initialized much later in flightgears bootstrap, and I did not
find an easy way to reorder that for my needs. Since this additional load is
very small and does only happen if such a relative location is required, I
think that this is ok.
Note that moving on the carrier will only work correctly for JSBSim and YASim,
but you should now be able to start and move on every not itself moving
object with any FDM.
2005-07-03 09:39:14 +00:00
|
|
|
static list<ParkPosition>
|
2005-03-19 09:57:18 +00:00
|
|
|
getAllOffsetNodeVals(const char* name, SGPropertyNode * entry_node);
|
2004-05-15 09:07:55 +00:00
|
|
|
|
Mathias Fröhlich:
I have introduced the posibility to start directly on the carrier.
With that patch you will have a --carrrier=id argument where id can either be
the pennant number configured in the nimitz scenario or the carriers name
also configured in the carriers scenario.
Additionaly you can use --parkpos=id to select different positions on the
carrier. They are also configured in the scenario file.
That includes the switch of the whole FGInterface class to make use of the
groundcache.
That means that an aircraft no longer uses the current elevation value from
the scenery class. It rather has its own local cache of the aircrafts
environment which is setup in the common_init method of FGInterface and
updated either manually by calling
FGInterface::get_groundlevel_m(lat, lon, alt_m);
or implicitly by calling the above method in the
FGInterface::_updateGeo*Position(lat, lon, alt);
methods.
A call get_groundlevel_m rebuilds the groundcache if the request is outside
the range of the cache.
Note that for the real usage of the groundcache including the correct
information about the movement of objects and the velocity information, you
still need to set up the groundcache in the usual way like YASim and JSBSim
currently does.
If you use the native interface, you will get only static objects correctly.
But for FDM's only using one single ground level for a whole step this is IMO
sufficient.
The AIManager gets a way to return the location of a object which is placed
wrt an AI Object. At the moment it only honours AICarriers for that.
That method is a static one, which loads the scenario file for that reason and
throws it away afterwards. This looked like the aprioriate way, because the
AIManager is initialized much later in flightgears bootstrap, and I did not
find an easy way to reorder that for my needs. Since this additional load is
very small and does only happen if such a relative location is required, I
think that this is ok.
Note that moving on the carrier will only work correctly for JSBSim and YASim,
but you should now be able to start and move on every not itself moving
object with any FDM.
2005-07-03 09:39:14 +00:00
|
|
|
FGAIScenario::FGAIScenario(const string &filename)
|
2004-05-15 09:07:55 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
SGPath path( globals->get_fg_root() );
|
2004-11-30 12:34:11 +00:00
|
|
|
|
2004-12-27 13:19:28 +00:00
|
|
|
// cout << "/Data/AI/" << filename << endl;
|
2004-11-30 12:34:11 +00:00
|
|
|
|
2004-05-15 09:07:55 +00:00
|
|
|
path.append( ("/Data/AI/" + filename + ".xml").c_str() );
|
|
|
|
SGPropertyNode root;
|
2005-08-16 09:37:23 +00:00
|
|
|
readProperties(path.str(), &root);
|
2004-11-30 12:34:11 +00:00
|
|
|
|
2004-12-27 13:19:28 +00:00
|
|
|
// cout <<"path " << path.str() << endl;
|
2004-11-30 12:34:11 +00:00
|
|
|
|
2004-05-15 09:07:55 +00:00
|
|
|
try {
|
|
|
|
readProperties(path.str(), &root);
|
|
|
|
} catch (const sg_exception &e) {
|
|
|
|
SG_LOG(SG_GENERAL, SG_ALERT,
|
|
|
|
"Incorrect path specified for AI scenario: ");
|
2004-11-30 12:34:11 +00:00
|
|
|
|
|
|
|
cout << path.str() << endl;
|
|
|
|
|
2004-05-15 09:07:55 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-09-22 10:03:26 +00:00
|
|
|
entries.clear();
|
2004-05-15 12:46:25 +00:00
|
|
|
SGPropertyNode * node = root.getNode("scenario");
|
2004-05-15 09:07:55 +00:00
|
|
|
for (i = 0; i < node->nChildren(); i++) {
|
2004-11-30 12:34:11 +00:00
|
|
|
|
2004-12-27 13:19:28 +00:00
|
|
|
// cout << "Reading entity data entry " << i << endl;
|
2004-11-30 12:34:11 +00:00
|
|
|
|
2004-05-15 09:07:55 +00:00
|
|
|
SGPropertyNode * entry_node = node->getChild(i);
|
2004-09-22 11:24:45 +00:00
|
|
|
|
|
|
|
FGAIModelEntity* en = new FGAIModelEntity;
|
2004-05-15 12:46:25 +00:00
|
|
|
en->callsign = entry_node->getStringValue("callsign", "none");
|
2004-09-07 09:53:23 +00:00
|
|
|
en->m_type = entry_node->getStringValue("type", "aircraft");
|
|
|
|
en->m_class = entry_node->getStringValue("class", "jet_transport");
|
|
|
|
en->path = entry_node->getStringValue("model", "Models/Geometry/glider.ac");
|
2004-05-15 12:46:25 +00:00
|
|
|
en->flightplan = entry_node->getStringValue("flightplan", "");
|
2006-01-30 22:08:53 +00:00
|
|
|
en->repeat = entry_node->getBoolValue("repeat", false);
|
2004-05-29 11:39:10 +00:00
|
|
|
en->latitude = entry_node->getDoubleValue("latitude", 0.0);
|
|
|
|
en->longitude = entry_node->getDoubleValue("longitude", 0.0);
|
|
|
|
en->altitude = entry_node->getDoubleValue("altitude", 0.0);
|
|
|
|
en->speed = entry_node->getDoubleValue("speed", 0.0);
|
|
|
|
en->heading = entry_node->getDoubleValue("heading", 0.0);
|
|
|
|
en->roll = entry_node->getDoubleValue("roll", 0.0);
|
|
|
|
en->azimuth = entry_node->getDoubleValue("azimuth", 0.0);
|
|
|
|
en->elevation = entry_node->getDoubleValue("elevation", 0.0);
|
2005-08-16 09:37:23 +00:00
|
|
|
en->rudder = entry_node->getFloatValue("rudder", 0.0);
|
2005-05-16 09:48:00 +00:00
|
|
|
en->strength = entry_node->getDoubleValue("strength-fps", 8.0);
|
2005-11-16 15:23:18 +00:00
|
|
|
en->turb_strength = entry_node->getDoubleValue("strength-norm", 1.0);
|
2004-06-03 17:59:14 +00:00
|
|
|
en->diameter = entry_node->getDoubleValue("diameter-ft", 0.0);
|
2004-11-07 14:46:21 +00:00
|
|
|
en->height_msl = entry_node->getDoubleValue("height-msl", 5000.0);
|
2004-08-26 16:25:54 +00:00
|
|
|
en->eda = entry_node->getDoubleValue("eda", 0.007);
|
2004-09-01 08:32:54 +00:00
|
|
|
en->life = entry_node->getDoubleValue("life", 900.0);
|
2004-09-20 19:29:16 +00:00
|
|
|
en->buoyancy = entry_node->getDoubleValue("buoyancy", 0);
|
|
|
|
en->wind_from_east = entry_node->getDoubleValue("wind_from_east", 0);
|
|
|
|
en->wind_from_north = entry_node->getDoubleValue("wind_from_north", 0);
|
2004-11-16 09:33:21 +00:00
|
|
|
en->wind = entry_node->getBoolValue ("wind", false);
|
|
|
|
en->cd = entry_node->getDoubleValue("cd", 0.029);
|
|
|
|
en->mass = entry_node->getDoubleValue("mass", 0.007);
|
|
|
|
en->radius = entry_node->getDoubleValue("turn-radius-ft", 2000);
|
2005-10-01 09:56:53 +00:00
|
|
|
en->TACAN_channel_ID= entry_node->getStringValue("TACAN-channel-ID", "029Y");
|
|
|
|
en->name = entry_node->getStringValue("name", "Nimitz");
|
2005-03-19 09:57:18 +00:00
|
|
|
en->pennant_number = entry_node->getStringValue("pennant-number", "");
|
|
|
|
en->wire_objects = getAllStringNodeVals("wire", entry_node);
|
|
|
|
en->catapult_objects = getAllStringNodeVals("catapult", entry_node);
|
|
|
|
en->solid_objects = getAllStringNodeVals("solid", entry_node);
|
|
|
|
en->ppositions = getAllOffsetNodeVals("parking-pos", entry_node);
|
2005-08-16 09:37:23 +00:00
|
|
|
en->max_lat = entry_node->getDoubleValue("max-lat", 0);
|
|
|
|
en->min_lat = entry_node->getDoubleValue("min-lat",0);
|
|
|
|
en->max_long = entry_node->getDoubleValue("max-long", 0);
|
|
|
|
en->min_long = entry_node->getDoubleValue("min-long", 0);
|
Mathias Fröhlich:
I have introduced the posibility to start directly on the carrier.
With that patch you will have a --carrrier=id argument where id can either be
the pennant number configured in the nimitz scenario or the carriers name
also configured in the carriers scenario.
Additionaly you can use --parkpos=id to select different positions on the
carrier. They are also configured in the scenario file.
That includes the switch of the whole FGInterface class to make use of the
groundcache.
That means that an aircraft no longer uses the current elevation value from
the scenery class. It rather has its own local cache of the aircrafts
environment which is setup in the common_init method of FGInterface and
updated either manually by calling
FGInterface::get_groundlevel_m(lat, lon, alt_m);
or implicitly by calling the above method in the
FGInterface::_updateGeo*Position(lat, lon, alt);
methods.
A call get_groundlevel_m rebuilds the groundcache if the request is outside
the range of the cache.
Note that for the real usage of the groundcache including the correct
information about the movement of objects and the velocity information, you
still need to set up the groundcache in the usual way like YASim and JSBSim
currently does.
If you use the native interface, you will get only static objects correctly.
But for FDM's only using one single ground level for a whole step this is IMO
sufficient.
The AIManager gets a way to return the location of a object which is placed
wrt an AI Object. At the moment it only honours AICarriers for that.
That method is a static one, which loads the scenario file for that reason and
throws it away afterwards. This looked like the aprioriate way, because the
AIManager is initialized much later in flightgears bootstrap, and I did not
find an easy way to reorder that for my needs. Since this additional load is
very small and does only happen if such a relative location is required, I
think that this is ok.
Note that moving on the carrier will only work correctly for JSBSim and YASim,
but you should now be able to start and move on every not itself moving
object with any FDM.
2005-07-03 09:39:14 +00:00
|
|
|
list<ParkPosition> flolspos = getAllOffsetNodeVals("flols-pos", entry_node);
|
|
|
|
en->flols_offset = flolspos.front().offset;
|
2004-11-26 10:24:48 +00:00
|
|
|
|
2004-09-20 19:29:16 +00:00
|
|
|
en->fp = NULL;
|
2004-09-22 10:03:26 +00:00
|
|
|
if (en->flightplan != ""){
|
|
|
|
en->fp = new FGAIFlightPlan( en->flightplan );
|
|
|
|
}
|
2004-09-22 11:24:45 +00:00
|
|
|
entries.push_back( en );
|
2004-05-15 09:07:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
entry_iterator = entries.begin();
|
|
|
|
//cout << entries.size() << " entries read." << endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FGAIScenario::~FGAIScenario()
|
|
|
|
{
|
|
|
|
entries.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-10-26 09:03:49 +00:00
|
|
|
FGAIModelEntity* const
|
2004-05-15 09:07:55 +00:00
|
|
|
FGAIScenario::getNextEntry( void )
|
|
|
|
{
|
David Culp:
First, preferences.xml will define the scenario filename.
For now, the other way of defining ai objects still works, so the sailboat
stays in preferences.xml. Later, I'll move the sailboat into the demo
scenario. If no scenario filename is given, then no scenario will be
processed.
I changed the demo scenario to create two 737's, one takes off on runway 01L,
and the other takes off on runway 01R. This will make a good demo for the ai
system. One problem, if you takeoff on 28L/R right away, you might run into
the taking-off 737's, or be scared.
2004-05-17 08:45:33 +00:00
|
|
|
if (entries.size() == 0) return 0;
|
|
|
|
if (entry_iterator != entries.end()) {
|
|
|
|
return *entry_iterator++;
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
2004-05-15 09:07:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int FGAIScenario::nEntries( void )
|
|
|
|
{
|
|
|
|
return entries.size();
|
|
|
|
}
|
|
|
|
|
2004-11-26 10:24:48 +00:00
|
|
|
static list<string>
|
2005-03-19 09:57:18 +00:00
|
|
|
getAllStringNodeVals(const char* name, SGPropertyNode * entry_node)
|
2004-11-26 10:24:48 +00:00
|
|
|
{
|
|
|
|
list<string> retval;
|
|
|
|
int i=0;
|
|
|
|
do {
|
|
|
|
char nodename[100];
|
|
|
|
snprintf(nodename, sizeof(nodename), "%s[%d]", name, i);
|
|
|
|
const char* objname = entry_node->getStringValue(nodename, 0);
|
|
|
|
if (objname == 0)
|
|
|
|
return retval;
|
|
|
|
|
|
|
|
retval.push_back(string(objname));
|
|
|
|
++i;
|
|
|
|
} while (1);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
Mathias Fröhlich:
I have introduced the posibility to start directly on the carrier.
With that patch you will have a --carrrier=id argument where id can either be
the pennant number configured in the nimitz scenario or the carriers name
also configured in the carriers scenario.
Additionaly you can use --parkpos=id to select different positions on the
carrier. They are also configured in the scenario file.
That includes the switch of the whole FGInterface class to make use of the
groundcache.
That means that an aircraft no longer uses the current elevation value from
the scenery class. It rather has its own local cache of the aircrafts
environment which is setup in the common_init method of FGInterface and
updated either manually by calling
FGInterface::get_groundlevel_m(lat, lon, alt_m);
or implicitly by calling the above method in the
FGInterface::_updateGeo*Position(lat, lon, alt);
methods.
A call get_groundlevel_m rebuilds the groundcache if the request is outside
the range of the cache.
Note that for the real usage of the groundcache including the correct
information about the movement of objects and the velocity information, you
still need to set up the groundcache in the usual way like YASim and JSBSim
currently does.
If you use the native interface, you will get only static objects correctly.
But for FDM's only using one single ground level for a whole step this is IMO
sufficient.
The AIManager gets a way to return the location of a object which is placed
wrt an AI Object. At the moment it only honours AICarriers for that.
That method is a static one, which loads the scenario file for that reason and
throws it away afterwards. This looked like the aprioriate way, because the
AIManager is initialized much later in flightgears bootstrap, and I did not
find an easy way to reorder that for my needs. Since this additional load is
very small and does only happen if such a relative location is required, I
think that this is ok.
Note that moving on the carrier will only work correctly for JSBSim and YASim,
but you should now be able to start and move on every not itself moving
object with any FDM.
2005-07-03 09:39:14 +00:00
|
|
|
static list<ParkPosition>
|
2005-03-19 09:57:18 +00:00
|
|
|
getAllOffsetNodeVals(const char* name, SGPropertyNode * entry_node)
|
|
|
|
{
|
Mathias Fröhlich:
I have introduced the posibility to start directly on the carrier.
With that patch you will have a --carrrier=id argument where id can either be
the pennant number configured in the nimitz scenario or the carriers name
also configured in the carriers scenario.
Additionaly you can use --parkpos=id to select different positions on the
carrier. They are also configured in the scenario file.
That includes the switch of the whole FGInterface class to make use of the
groundcache.
That means that an aircraft no longer uses the current elevation value from
the scenery class. It rather has its own local cache of the aircrafts
environment which is setup in the common_init method of FGInterface and
updated either manually by calling
FGInterface::get_groundlevel_m(lat, lon, alt_m);
or implicitly by calling the above method in the
FGInterface::_updateGeo*Position(lat, lon, alt);
methods.
A call get_groundlevel_m rebuilds the groundcache if the request is outside
the range of the cache.
Note that for the real usage of the groundcache including the correct
information about the movement of objects and the velocity information, you
still need to set up the groundcache in the usual way like YASim and JSBSim
currently does.
If you use the native interface, you will get only static objects correctly.
But for FDM's only using one single ground level for a whole step this is IMO
sufficient.
The AIManager gets a way to return the location of a object which is placed
wrt an AI Object. At the moment it only honours AICarriers for that.
That method is a static one, which loads the scenario file for that reason and
throws it away afterwards. This looked like the aprioriate way, because the
AIManager is initialized much later in flightgears bootstrap, and I did not
find an easy way to reorder that for my needs. Since this additional load is
very small and does only happen if such a relative location is required, I
think that this is ok.
Note that moving on the carrier will only work correctly for JSBSim and YASim,
but you should now be able to start and move on every not itself moving
object with any FDM.
2005-07-03 09:39:14 +00:00
|
|
|
list<ParkPosition> retval;
|
2005-03-19 09:57:18 +00:00
|
|
|
|
2005-10-26 09:03:49 +00:00
|
|
|
vector<SGPropertyNode_ptr>::const_iterator it;
|
2005-03-19 09:57:18 +00:00
|
|
|
vector<SGPropertyNode_ptr> children = entry_node->getChildren(name);
|
|
|
|
for (it = children.begin(); it != children.end(); ++it) {
|
Mathias Fröhlich:
I have introduced the posibility to start directly on the carrier.
With that patch you will have a --carrrier=id argument where id can either be
the pennant number configured in the nimitz scenario or the carriers name
also configured in the carriers scenario.
Additionaly you can use --parkpos=id to select different positions on the
carrier. They are also configured in the scenario file.
That includes the switch of the whole FGInterface class to make use of the
groundcache.
That means that an aircraft no longer uses the current elevation value from
the scenery class. It rather has its own local cache of the aircrafts
environment which is setup in the common_init method of FGInterface and
updated either manually by calling
FGInterface::get_groundlevel_m(lat, lon, alt_m);
or implicitly by calling the above method in the
FGInterface::_updateGeo*Position(lat, lon, alt);
methods.
A call get_groundlevel_m rebuilds the groundcache if the request is outside
the range of the cache.
Note that for the real usage of the groundcache including the correct
information about the movement of objects and the velocity information, you
still need to set up the groundcache in the usual way like YASim and JSBSim
currently does.
If you use the native interface, you will get only static objects correctly.
But for FDM's only using one single ground level for a whole step this is IMO
sufficient.
The AIManager gets a way to return the location of a object which is placed
wrt an AI Object. At the moment it only honours AICarriers for that.
That method is a static one, which loads the scenario file for that reason and
throws it away afterwards. This looked like the aprioriate way, because the
AIManager is initialized much later in flightgears bootstrap, and I did not
find an easy way to reorder that for my needs. Since this additional load is
very small and does only happen if such a relative location is required, I
think that this is ok.
Note that moving on the carrier will only work correctly for JSBSim and YASim,
but you should now be able to start and move on every not itself moving
object with any FDM.
2005-07-03 09:39:14 +00:00
|
|
|
string name = (*it)->getStringValue("name", "unnamed");
|
2005-03-19 09:57:18 +00:00
|
|
|
double offset_x = (*it)->getDoubleValue("x-offset-m", 0);
|
|
|
|
double offset_y = (*it)->getDoubleValue("y-offset-m", 0);
|
|
|
|
double offset_z = (*it)->getDoubleValue("z-offset-m", 0);
|
Mathias Fröhlich:
I have introduced the posibility to start directly on the carrier.
With that patch you will have a --carrrier=id argument where id can either be
the pennant number configured in the nimitz scenario or the carriers name
also configured in the carriers scenario.
Additionaly you can use --parkpos=id to select different positions on the
carrier. They are also configured in the scenario file.
That includes the switch of the whole FGInterface class to make use of the
groundcache.
That means that an aircraft no longer uses the current elevation value from
the scenery class. It rather has its own local cache of the aircrafts
environment which is setup in the common_init method of FGInterface and
updated either manually by calling
FGInterface::get_groundlevel_m(lat, lon, alt_m);
or implicitly by calling the above method in the
FGInterface::_updateGeo*Position(lat, lon, alt);
methods.
A call get_groundlevel_m rebuilds the groundcache if the request is outside
the range of the cache.
Note that for the real usage of the groundcache including the correct
information about the movement of objects and the velocity information, you
still need to set up the groundcache in the usual way like YASim and JSBSim
currently does.
If you use the native interface, you will get only static objects correctly.
But for FDM's only using one single ground level for a whole step this is IMO
sufficient.
The AIManager gets a way to return the location of a object which is placed
wrt an AI Object. At the moment it only honours AICarriers for that.
That method is a static one, which loads the scenario file for that reason and
throws it away afterwards. This looked like the aprioriate way, because the
AIManager is initialized much later in flightgears bootstrap, and I did not
find an easy way to reorder that for my needs. Since this additional load is
very small and does only happen if such a relative location is required, I
think that this is ok.
Note that moving on the carrier will only work correctly for JSBSim and YASim,
but you should now be able to start and move on every not itself moving
object with any FDM.
2005-07-03 09:39:14 +00:00
|
|
|
double hd = (*it)->getDoubleValue("heading-offset-deg", 0);
|
|
|
|
ParkPosition pp(name, Point3D(offset_x, offset_y, offset_z), hd);
|
|
|
|
retval.push_back(pp);
|
2005-03-19 09:57:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
2004-11-26 10:24:48 +00:00
|
|
|
|
2004-09-22 08:47:05 +00:00
|
|
|
// end scenario.cxx
|
2004-09-27 14:24:20 +00:00
|
|
|
|