Merge commit 'refs/merge-requests/11' of git://gitorious.org/fg/flightgear into vivian
This commit is contained in:
commit
f52cf4e3b8
1 changed files with 17 additions and 4 deletions
|
@ -143,6 +143,8 @@ bool FGAIBallistic::init(bool search_in_AI_path) {
|
|||
|
||||
_elapsed_time += (sg_random() * 100);
|
||||
|
||||
_life_timer = 0;
|
||||
|
||||
props->setStringValue("material/name", "");
|
||||
props->setStringValue("name", _name.c_str());
|
||||
props->setStringValue("submodels/path", _path.c_str());
|
||||
|
@ -152,6 +154,9 @@ bool FGAIBallistic::init(bool search_in_AI_path) {
|
|||
props->setStringValue("contents/path", _contents_path.c_str());
|
||||
}
|
||||
|
||||
//cout << "init: name " << _name.c_str() << " _life_timer " << _life_timer
|
||||
// << endl;
|
||||
|
||||
//if(_parent != ""){
|
||||
// setParentNode();
|
||||
//}
|
||||
|
@ -330,7 +335,7 @@ void FGAIBallistic::setLife(double seconds) {
|
|||
|
||||
if (_random){
|
||||
life = seconds * _randomness + (seconds * (1 -_randomness) * sg_random());
|
||||
//cout << "life " << life << endl;
|
||||
//cout << " set life " << life << endl;
|
||||
} else
|
||||
life = seconds;
|
||||
}
|
||||
|
@ -671,14 +676,22 @@ void FGAIBallistic::slaveToAC(double dt){
|
|||
void FGAIBallistic::Run(double dt) {
|
||||
_life_timer += dt;
|
||||
|
||||
//_pass += 1;
|
||||
//cout<<"AIBallistic run: name " << _name.c_str()
|
||||
// << " dt " << dt << " _life_timer " << _life_timer << " pass " << _pass << endl;
|
||||
|
||||
// if life = -1 the object does not die
|
||||
if (_life_timer > life && life != -1){
|
||||
|
||||
if (_report_expiry && !_expiry_reported && !_impact_reported && !_collision_reported){
|
||||
//cout<<"AIBallistic: expiry"<< endl;
|
||||
//cout<<"AIBallistic run: name " << _name.c_str() << " expiry " << " pass " << _pass <<endl;
|
||||
handle_expiry();
|
||||
} else
|
||||
} else{
|
||||
//cout<<"AIBallistic run: name " << _name.c_str()
|
||||
// << " die " << " _life_timer " << _life_timer << " pass " << _pass << endl;
|
||||
setDie(true);
|
||||
setTime(0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -1010,7 +1023,7 @@ void FGAIBallistic::report_impact(double elevation, const FGAIBase *object)
|
|||
n->setStringValue("type", "terrain");
|
||||
|
||||
SG_LOG(SG_GENERAL, SG_DEBUG, "AIBallistic: object impact " << _name
|
||||
<< " lon " <<_impact_lon << " lat " <<_impact_lat);
|
||||
<< " lon " <<_impact_lon << " lat " <<_impact_lat << " sec " << _life_timer);
|
||||
|
||||
n->setDoubleValue("longitude-deg", _impact_lon);
|
||||
n->setDoubleValue("latitude-deg", _impact_lat);
|
||||
|
|
Loading…
Reference in a new issue