Merge commit 'refs/merge-requests/1591' of https://gitorious.org/fg/flightgear into merge-requests/1591
This commit is contained in:
commit
8451b6c7c7
5 changed files with 19 additions and 5 deletions
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -110,6 +110,7 @@ public:
|
|||
int _getSubID() const;
|
||||
|
||||
bool getDie();
|
||||
bool isValid();
|
||||
|
||||
SGVec3d getCartPosAt(const SGVec3d& off) const;
|
||||
SGVec3d getCartPos() const;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue