1
0
Fork 0

commit some pending updates from Vivian

This commit is contained in:
ehofman 2004-11-16 09:33:21 +00:00
parent d43d10046b
commit 9a8eaae03d
5 changed files with 31 additions and 10 deletions

View file

@ -203,6 +203,7 @@ void FGAIBase::bind() {
SGRawValueFunctions<bool>(_isNight)); SGRawValueFunctions<bool>(_isNight));
props->setBoolValue("controls/lighting/beacon", true); props->setBoolValue("controls/lighting/beacon", true);
props->setBoolValue("controls/lighting/strobe", true); props->setBoolValue("controls/lighting/strobe", true);
props->setBoolValue("controls/glide-path", true);
} }
void FGAIBase::unbind() { void FGAIBase::unbind() {

View file

@ -67,6 +67,8 @@ typedef struct {
bool wind; // if true, model reacts to parent wind bool wind; // if true, model reacts to parent wind
double mass; // in slugs double mass; // in slugs
bool aero_stabilised; // if true, ballistic object aligns with trajectory bool aero_stabilised; // if true, ballistic object aligns with trajectory
double radius; // used by ship ojects, in feet
} FGAIModelEntity; } FGAIModelEntity;
@ -94,6 +96,7 @@ public:
void setLatitude( double latitude ); void setLatitude( double latitude );
void setLongitude( double longitude ); void setLongitude( double longitude );
void setBank( double bank ); void setBank( double bank );
void setRadius ( double radius );
void* getID(); void* getID();
void setDie( bool die ); void setDie( bool die );
@ -111,7 +114,8 @@ protected:
double pitch; // degrees, nose-down is negative double pitch; // degrees, nose-down is negative
double speed; // knots true airspeed double speed; // knots true airspeed
double altitude; // meters above sea level 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_lon;
double ft_per_deg_lat; double ft_per_deg_lat;
@ -206,6 +210,10 @@ inline void FGAIBase::setSpeed( double speed_KTAS ) {
speed = tgt_speed = speed_KTAS; speed = tgt_speed = speed_KTAS;
} }
inline void FGAIBase::setRadius( double radius ) {
turn_radius_ft = radius;
}
inline void FGAIBase::setHeading( double heading ) { inline void FGAIBase::setHeading( double heading ) {
hdg = tgt_heading = heading; hdg = tgt_heading = heading;
} }

View file

@ -52,8 +52,8 @@ FGAIFlightPlan::FGAIFlightPlan(string filename)
readProperties(path.str(), &root); readProperties(path.str(), &root);
} catch (const sg_exception &e) { } catch (const sg_exception &e) {
SG_LOG(SG_GENERAL, SG_ALERT, SG_LOG(SG_GENERAL, SG_ALERT,
"Error reading AI flight plan: "); "Error reading AI flight plan: " << path.str());
cout << path.str() << endl; // cout << path.str() << endl;
return; return;
} }

View file

@ -163,6 +163,8 @@ FGAIManager::createAircraft( FGAIModelEntity *entity ) {
void* void*
FGAIManager::createShip( FGAIModelEntity *entity ) { FGAIManager::createShip( FGAIModelEntity *entity ) {
//cout << "creating ship" << endl;
FGAIShip* ai_ship = new FGAIShip(this); FGAIShip* ai_ship = new FGAIShip(this);
ai_list.push_back(ai_ship); ai_list.push_back(ai_ship);
@ -187,6 +189,8 @@ FGAIManager::createShip( FGAIModelEntity *entity ) {
void* void*
FGAIManager::createCarrier( FGAIModelEntity *entity ) { FGAIManager::createCarrier( FGAIModelEntity *entity ) {
//cout << "creating carrier" << endl;
FGAIShip* ai_carrier = new FGAICarrier(this); FGAIShip* ai_carrier = new FGAICarrier(this);
ai_list.push_back(ai_carrier); ai_list.push_back(ai_carrier);
@ -199,6 +203,7 @@ FGAIManager::createCarrier( FGAIModelEntity *entity ) {
ai_carrier->setLongitude(entity->longitude); ai_carrier->setLongitude(entity->longitude);
ai_carrier->setLatitude(entity->latitude); ai_carrier->setLatitude(entity->latitude);
ai_carrier->setBank(entity->rudder); ai_carrier->setBank(entity->rudder);
ai_carrier->setRadius(entity->radius);
if ( entity->fp ) { if ( entity->fp ) {
ai_carrier->setFlightPlan(entity->fp); ai_carrier->setFlightPlan(entity->fp);

View file

@ -38,22 +38,24 @@ FGAIScenario::FGAIScenario(string &filename)
{ {
int i; int i;
SGPath path( globals->get_fg_root() ); SGPath path( globals->get_fg_root() );
//cout << "/Data/AI/" << filename << endl;
path.append( ("/Data/AI/" + filename + ".xml").c_str() ); path.append( ("/Data/AI/" + filename + ".xml").c_str() );
SGPropertyNode root; SGPropertyNode root;
readProperties(path.str(), &root);
//cout <<"path " << path.str() << endl;
try { try {
readProperties(path.str(), &root); readProperties(path.str(), &root);
} catch (const sg_exception &e) { } catch (const sg_exception &e) {
SG_LOG(SG_GENERAL, SG_ALERT, SG_LOG(SG_GENERAL, SG_ALERT,
"Incorrect path specified for AI scenario: "); "Incorrect path specified for AI scenario: ");
cout << path.str() << endl; //cout << path.str() << endl;
return; return;
} }
entries.clear(); entries.clear();
SGPropertyNode * node = root.getNode("scenario"); SGPropertyNode * node = root.getNode("scenario");
for (i = 0; i < node->nChildren(); i++) { 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); SGPropertyNode * entry_node = node->getChild(i);
FGAIModelEntity* en = new FGAIModelEntity; FGAIModelEntity* en = new FGAIModelEntity;
@ -80,11 +82,16 @@ FGAIScenario::FGAIScenario(string &filename)
en->buoyancy = entry_node->getDoubleValue("buoyancy", 0); en->buoyancy = entry_node->getDoubleValue("buoyancy", 0);
en->wind_from_east = entry_node->getDoubleValue("wind_from_east", 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_from_north = entry_node->getDoubleValue("wind_from_north", 0);
en->wind = entry_node->getBoolValue("wind", false); en->wind = entry_node->getBoolValue ("wind", false);
en->cd = entry_node->getDoubleValue ("cd", 0.029); en->cd = entry_node->getDoubleValue("cd", 0.029);
en->mass = entry_node->getDoubleValue ("mass", 0.007); 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; en->fp = NULL;
if (en->flightplan != ""){ if (en->flightplan != ""){
en->fp = new FGAIFlightPlan( en->flightplan ); en->fp = new FGAIFlightPlan( en->flightplan );