Revert to previous revision after an error during last commit
This commit is contained in:
parent
12009ea688
commit
dc2341b643
3 changed files with 20 additions and 22 deletions
src
|
@ -145,8 +145,7 @@ void FGAIAircraft::setPerformance(const std::string& acclass) {
|
|||
FGAIAircraft::dt = dt;
|
||||
|
||||
try {
|
||||
if ( !updatePrimaryTargetValues() ) // target hdg, alt, speed
|
||||
return;
|
||||
updatePrimaryTargetValues(); // target hdg, alt, speed
|
||||
}
|
||||
catch (AI_OutOfSight) {
|
||||
return;
|
||||
|
@ -730,7 +729,7 @@ void FGAIAircraft::controlSpeed(FGAIFlightPlan::waypoint* curr, FGAIFlightPlan::
|
|||
/**
|
||||
* Update target values (heading, alt, speed) depending on flight plan or control properties
|
||||
*/
|
||||
bool FGAIAircraft::updatePrimaryTargetValues() {
|
||||
void FGAIAircraft::updatePrimaryTargetValues() {
|
||||
if (fp) // AI object has a flightplan
|
||||
{
|
||||
//TODO make this a function of AIBase
|
||||
|
@ -759,7 +758,7 @@ bool FGAIAircraft::updatePrimaryTargetValues() {
|
|||
}
|
||||
timeElapsed = now - fp->getStartTime();
|
||||
if (! fp->isActive(now)) {
|
||||
return false;
|
||||
throw FP_Inactive();
|
||||
}
|
||||
} else {
|
||||
// no flight plan, update target heading, speed, and altitude
|
||||
|
@ -790,7 +789,6 @@ bool FGAIAircraft::updatePrimaryTargetValues() {
|
|||
|
||||
AccelTo( props->getDoubleValue("controls/flight/target-spd" ) );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void FGAIAircraft::updatePosition() {
|
||||
|
|
|
@ -117,7 +117,7 @@ private:
|
|||
void controlHeading(FGAIFlightPlan::waypoint* curr);
|
||||
void controlSpeed(FGAIFlightPlan::waypoint* curr,
|
||||
FGAIFlightPlan::waypoint* next);
|
||||
bool updatePrimaryTargetValues();
|
||||
void updatePrimaryTargetValues();
|
||||
void updateSecondaryTargetValues();
|
||||
void updatePosition();
|
||||
void updateHeading();
|
||||
|
|
|
@ -156,23 +156,23 @@ struct UpdateFunctor : public std::unary_function<FGModelMgr::Instance*, void>
|
|||
SGModelPlacement* model = instance->model;
|
||||
double lon, lat, elev, roll, pitch, heading;
|
||||
|
||||
// Optionally set position from properties
|
||||
if (instance->lon_deg_node != 0)
|
||||
lon =instance->lon_deg_node->getDoubleValue();
|
||||
if (instance->lat_deg_node != 0)
|
||||
lat = instance->lat_deg_node->getDoubleValue();
|
||||
if (instance->elev_ft_node != 0)
|
||||
elev = instance->elev_ft_node->getDoubleValue();
|
||||
try {
|
||||
// Optionally set position from properties
|
||||
if (instance->lon_deg_node != 0)
|
||||
lon = testNan(instance->lon_deg_node->getDoubleValue());
|
||||
if (instance->lat_deg_node != 0)
|
||||
lat = testNan(instance->lat_deg_node->getDoubleValue());
|
||||
if (instance->elev_ft_node != 0)
|
||||
elev = testNan(instance->elev_ft_node->getDoubleValue());
|
||||
|
||||
// Optionally set orientation from properties
|
||||
if (instance->roll_deg_node != 0)
|
||||
roll = instance->roll_deg_node->getDoubleValue();
|
||||
if (instance->pitch_deg_node != 0)
|
||||
pitch = instance->pitch_deg_node->getDoubleValue();
|
||||
if (instance->heading_deg_node != 0)
|
||||
heading = instance->heading_deg_node->getDoubleValue();
|
||||
if ( osg::isNaN(lon) || osg::isNaN(lat) || osg::isNaN(elev) ||
|
||||
osg::isNaN(roll) || osg::isNaN(pitch) || osg::isNaN(heading) ) {
|
||||
// Optionally set orientation from properties
|
||||
if (instance->roll_deg_node != 0)
|
||||
roll = testNan(instance->roll_deg_node->getDoubleValue());
|
||||
if (instance->pitch_deg_node != 0)
|
||||
pitch = testNan(instance->pitch_deg_node->getDoubleValue());
|
||||
if (instance->heading_deg_node != 0)
|
||||
heading = testNan(instance->heading_deg_node->getDoubleValue());
|
||||
} catch (const sg_range_exception& e) {
|
||||
const char *path = instance->node->getStringValue("path",
|
||||
"unknown");
|
||||
SG_LOG(SG_GENERAL, SG_INFO, "Instance of model " << path
|
||||
|
|
Loading…
Add table
Reference in a new issue