diff --git a/src/AIModel/AIBase.cxx b/src/AIModel/AIBase.cxx index db566a1ef..1ef585b6e 100644 --- a/src/AIModel/AIBase.cxx +++ b/src/AIModel/AIBase.cxx @@ -203,6 +203,7 @@ void FGAIBase::bind() { SGRawValueFunctions(_isNight)); props->setBoolValue("controls/lighting/beacon", true); props->setBoolValue("controls/lighting/strobe", true); + props->setBoolValue("controls/glide-path", true); } void FGAIBase::unbind() { diff --git a/src/AIModel/AIBase.hxx b/src/AIModel/AIBase.hxx index 941ac87fa..7bb3b607c 100644 --- a/src/AIModel/AIBase.hxx +++ b/src/AIModel/AIBase.hxx @@ -67,6 +67,8 @@ typedef struct { 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; @@ -94,6 +96,7 @@ public: void setLatitude( double latitude ); void setLongitude( double longitude ); void setBank( double bank ); + void setRadius ( double radius ); void* getID(); void setDie( bool die ); @@ -111,7 +114,8 @@ protected: 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; @@ -206,6 +210,10 @@ inline void FGAIBase::setSpeed( double speed_KTAS ) { 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; } diff --git a/src/AIModel/AIFlightPlan.cxx b/src/AIModel/AIFlightPlan.cxx index 04bfbe357..a0faa6028 100644 --- a/src/AIModel/AIFlightPlan.cxx +++ b/src/AIModel/AIFlightPlan.cxx @@ -52,8 +52,8 @@ FGAIFlightPlan::FGAIFlightPlan(string filename) 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; } diff --git a/src/AIModel/AIManager.cxx b/src/AIModel/AIManager.cxx index c925deaa8..f9b641c4d 100644 --- a/src/AIModel/AIManager.cxx +++ b/src/AIModel/AIManager.cxx @@ -163,6 +163,8 @@ FGAIManager::createAircraft( FGAIModelEntity *entity ) { void* FGAIManager::createShip( FGAIModelEntity *entity ) { + + //cout << "creating ship" << endl; FGAIShip* ai_ship = new FGAIShip(this); ai_list.push_back(ai_ship); @@ -187,6 +189,8 @@ FGAIManager::createShip( FGAIModelEntity *entity ) { void* FGAIManager::createCarrier( FGAIModelEntity *entity ) { + + //cout << "creating carrier" << endl; FGAIShip* ai_carrier = new FGAICarrier(this); ai_list.push_back(ai_carrier); @@ -199,6 +203,7 @@ FGAIManager::createCarrier( FGAIModelEntity *entity ) { 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); diff --git a/src/AIModel/AIScenario.cxx b/src/AIModel/AIScenario.cxx index b4db6abfd..37f5d8427 100644 --- a/src/AIModel/AIScenario.cxx +++ b/src/AIModel/AIScenario.cxx @@ -38,22 +38,24 @@ FGAIScenario::FGAIScenario(string &filename) { 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; @@ -80,11 +82,16 @@ FGAIScenario::FGAIScenario(string &filename) 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 );