Some small updates
This commit is contained in:
parent
378a4ba0f7
commit
3297ac3544
2 changed files with 14 additions and 6 deletions
|
@ -63,6 +63,7 @@ bool FGAIBase::init() {
|
|||
}
|
||||
|
||||
tgt_roll = tgt_pitch = tgt_yaw = tgt_vs = vs = roll = pitch = 0.0;
|
||||
setDie(false);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue