1
0
Fork 0

Some small updates

This commit is contained in:
ehofman 2003-11-28 20:05:32 +00:00
parent 378a4ba0f7
commit 3297ac3544
2 changed files with 14 additions and 6 deletions

View file

@ -63,6 +63,7 @@ bool FGAIBase::init() {
}
tgt_roll = tgt_pitch = tgt_yaw = tgt_vs = vs = roll = pitch = 0.0;
setDie(false);
}

View file

@ -37,7 +37,12 @@ FGAIManager::FGAIManager() {
}
FGAIManager::~FGAIManager() {
ai_list.clear();
ai_list_itr = ai_list.begin();
while(ai_list_itr != ai_list.end()) {
delete (*ai_list_itr);
++ai_list_itr;
}
ai_list.clear();
}
void FGAIManager::init() {
@ -115,13 +120,15 @@ void FGAIManager::update(double dt) {
}
#endif
ai_list_itr = ai_list.begin();
while(ai_list_itr != ai_list.end()) {
ai_list_itr = ai_list.begin();
while(ai_list_itr != ai_list.end()) {
if ((*ai_list_itr)->getDie()) {
// FIXME: delete object itself before removing it from the list.
// delete (*ai_list_itr);
ai_list.erase(ai_list_itr, ai_list_itr);
} else {
(*ai_list_itr)->update(dt);
}
(*ai_list_itr)->update(dt);
}
++ai_list_itr;
}
}
}