1
0
Fork 0

Merge commit 'refs/merge-requests/11' of git://gitorious.org/fg/flightgear into vivian

This commit is contained in:
Torsten Dreyer 2011-06-08 20:12:53 +02:00
commit f52cf4e3b8

View file

@ -143,6 +143,8 @@ bool FGAIBallistic::init(bool search_in_AI_path) {
_elapsed_time += (sg_random() * 100); _elapsed_time += (sg_random() * 100);
_life_timer = 0;
props->setStringValue("material/name", ""); props->setStringValue("material/name", "");
props->setStringValue("name", _name.c_str()); props->setStringValue("name", _name.c_str());
props->setStringValue("submodels/path", _path.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()); props->setStringValue("contents/path", _contents_path.c_str());
} }
//cout << "init: name " << _name.c_str() << " _life_timer " << _life_timer
// << endl;
//if(_parent != ""){ //if(_parent != ""){
// setParentNode(); // setParentNode();
//} //}
@ -330,7 +335,7 @@ void FGAIBallistic::setLife(double seconds) {
if (_random){ if (_random){
life = seconds * _randomness + (seconds * (1 -_randomness) * sg_random()); life = seconds * _randomness + (seconds * (1 -_randomness) * sg_random());
//cout << "life " << life << endl; //cout << " set life " << life << endl;
} else } else
life = seconds; life = seconds;
} }
@ -670,15 +675,23 @@ void FGAIBallistic::slaveToAC(double dt){
void FGAIBallistic::Run(double dt) { void FGAIBallistic::Run(double dt) {
_life_timer += 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 = -1 the object does not die
if (_life_timer > life && life != -1){ if (_life_timer > life && life != -1){
if (_report_expiry && !_expiry_reported && !_impact_reported && !_collision_reported){ 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(); handle_expiry();
} else } else{
//cout<<"AIBallistic run: name " << _name.c_str()
// << " die " << " _life_timer " << _life_timer << " pass " << _pass << endl;
setDie(true); setDie(true);
setTime(0);
}
} }
@ -1010,7 +1023,7 @@ void FGAIBallistic::report_impact(double elevation, const FGAIBase *object)
n->setStringValue("type", "terrain"); n->setStringValue("type", "terrain");
SG_LOG(SG_GENERAL, SG_DEBUG, "AIBallistic: object impact " << _name 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("longitude-deg", _impact_lon);
n->setDoubleValue("latitude-deg", _impact_lat); n->setDoubleValue("latitude-deg", _impact_lat);