commit some pending updates from Vivian
This commit is contained in:
parent
d43d10046b
commit
9a8eaae03d
5 changed files with 31 additions and 10 deletions
|
@ -203,6 +203,7 @@ void FGAIBase::bind() {
|
|||
SGRawValueFunctions<bool>(_isNight));
|
||||
props->setBoolValue("controls/lighting/beacon", true);
|
||||
props->setBoolValue("controls/lighting/strobe", true);
|
||||
props->setBoolValue("controls/glide-path", true);
|
||||
}
|
||||
|
||||
void FGAIBase::unbind() {
|
||||
|
|
|
@ -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 );
|
||||
|
@ -112,6 +115,7 @@ protected:
|
|||
double speed; // knots true airspeed
|
||||
double altitude; // meters above sea level
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -164,6 +164,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);
|
||||
++numObjects[0];
|
||||
|
@ -188,6 +190,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);
|
||||
++numObjects[0];
|
||||
|
@ -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);
|
||||
|
|
|
@ -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,10 +82,15 @@ 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 != ""){
|
||||
|
|
Loading…
Reference in a new issue