SGRawValueFunctions<bool>(_isNight));
props->setBoolValue("controls/lighting/beacon", true);
props->setBoolValue("controls/lighting/strobe", true);
+ props->setBoolValue("controls/glide-path", true);
}
void FGAIBase::unbind() {
bool wind; // if true, model reacts to parent wind
double mass; // in slugs
bool aero_stabilised; // if true, ballistic object aligns with trajectory
+ double radius; // used by ship ojects, in feet
+
} FGAIModelEntity;
void setLatitude( double latitude );
void setLongitude( double longitude );
void setBank( double bank );
+ void setRadius ( double radius );
void* getID();
void setDie( bool die );
double pitch; // degrees, nose-down is negative
double speed; // knots true airspeed
double altitude; // meters above sea level
- double vs; // vertical speed, feet per minute
+ double vs; // vertical speed, feet per minute
+ double turn_radius_ft; // turn radius ft at 15 kts rudder angle 15 degrees
double ft_per_deg_lon;
double ft_per_deg_lat;
speed = tgt_speed = speed_KTAS;
}
+inline void FGAIBase::setRadius( double radius ) {
+ turn_radius_ft = radius;
+}
+
inline void FGAIBase::setHeading( double heading ) {
hdg = tgt_heading = heading;
}
readProperties(path.str(), &root);
} catch (const sg_exception &e) {
SG_LOG(SG_GENERAL, SG_ALERT,
- "Error reading AI flight plan: ");
- cout << path.str() << endl;
+ "Error reading AI flight plan: " << path.str());
+ // cout << path.str() << endl;
return;
}
void*
FGAIManager::createShip( FGAIModelEntity *entity ) {
+
+ //cout << "creating ship" << endl;
FGAIShip* ai_ship = new FGAIShip(this);
ai_list.push_back(ai_ship);
void*
FGAIManager::createCarrier( FGAIModelEntity *entity ) {
+
+ //cout << "creating carrier" << endl;
FGAIShip* ai_carrier = new FGAICarrier(this);
ai_list.push_back(ai_carrier);
ai_carrier->setLongitude(entity->longitude);
ai_carrier->setLatitude(entity->latitude);
ai_carrier->setBank(entity->rudder);
+ ai_carrier->setRadius(entity->radius);
if ( entity->fp ) {
ai_carrier->setFlightPlan(entity->fp);
{
int i;
SGPath path( globals->get_fg_root() );
+ //cout << "/Data/AI/" << filename << endl;
path.append( ("/Data/AI/" + filename + ".xml").c_str() );
SGPropertyNode root;
-
+ readProperties(path.str(), &root);
+ //cout <<"path " << path.str() << endl;
try {
readProperties(path.str(), &root);
} catch (const sg_exception &e) {
SG_LOG(SG_GENERAL, SG_ALERT,
"Incorrect path specified for AI scenario: ");
- cout << path.str() << endl;
+ //cout << path.str() << endl;
return;
}
entries.clear();
SGPropertyNode * node = root.getNode("scenario");
for (i = 0; i < node->nChildren(); i++) {
- //cout << "Reading entry " << i << endl;
+ //cout << "Reading entity data entry " << i << endl;
SGPropertyNode * entry_node = node->getChild(i);
FGAIModelEntity* en = new FGAIModelEntity;
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);
- en->wind = entry_node->getBoolValue("wind", false);
- en->cd = entry_node->getDoubleValue ("cd", 0.029);
- en->mass = entry_node->getDoubleValue ("mass", 0.007);
-
-
+ 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);
+
+ /* en->name = entry_node->getStringValue("name", "");
+ en->x_pivot = entry_node->getDoubleValue("x-pivot", 0.0);
+ en->y_pivot = entry_node->getDoubleValue("y-pivot", 0.0);
+ en->z_pivot = entry_node->getDoubleValue("z-pivot", 0.0); */
+
en->fp = NULL;
if (en->flightplan != ""){
en->fp = new FGAIFlightPlan( en->flightplan );