1
0
Fork 0

Merge commit 'refs/merge-requests/1591' of https://gitorious.org/fg/flightgear into merge-requests/1591

This commit is contained in:
Torsten Dreyer 2015-02-22 21:25:08 +01:00
commit 8451b6c7c7
5 changed files with 19 additions and 5 deletions

View file

@ -106,7 +106,6 @@ public:
bool getInteriorLoaded(void) { return _interiorLoaded;}
bool hasInteriorPath(void) { return _hasInteriorPath;}
inline std::string& getInteriorPath() { return _interiorPath; }
private:
std::auto_ptr<FGNasalModelDataProxy> _nasal;
std::string _fxpath;
@ -932,5 +931,7 @@ int FGAIBase::_newAIModelID() {
return id;
}
bool FGAIBase::isValid() {
//Either no flightplan or it is valid
return !fp || fp->isValidPlan();
}

View file

@ -110,6 +110,7 @@ public:
int _getSubID() const;
bool getDie();
bool isValid();
SGVec3d getCartPosAt(const SGVec3d& off) const;
SGVec3d getCartPos() const;

View file

@ -251,6 +251,11 @@ bool FGAIFlightPlan::parseProperties(const std::string& filename)
wpt->setFinished ((wpt->getName() == "END"));
pushBackWaypoint( wpt );
}
if( getLastWaypoint()->getName().compare("END") != 0 ) {
SG_LOG(SG_AI, SG_ALERT, "FGAIFlightPlan::Flightplan missing END node" );
return false;
}
wpt_iterator = waypoints.begin();
return true;

View file

@ -244,7 +244,7 @@ private:
public:
wpt_vector_iterator getFirstWayPoint() { return waypoints.begin(); };
wpt_vector_iterator getLastWayPoint() { return waypoints.end(); };
bool isValidPlan() { return isValid; };
bool isValidPlan() { return isValid; };
};
#endif // _FG_AIFLIGHTPLAN_HXX

View file

@ -408,7 +408,14 @@ FGAIBasePtr FGAIManager::addObject(const SGPropertyNode* definition)
}
ai->readFromScenario(const_cast<SGPropertyNode*>(definition));
attach(ai);
if((ai->isValid())){
attach(ai);
SG_LOG(SG_AI, SG_DEBUG, "attached scenario " << ai->_getName());
}
else{
ai->setDie(true);
SG_LOG(SG_AI, SG_ALERT, "killed invalid scenario " << ai->_getName());
}
return ai;
}