Don't destroy the elements ourselves. Instead clear
() calls the destructor for each element itself.
This commit is contained in:
parent
3297ac3544
commit
a9c6ca26af
1 changed files with 0 additions and 7 deletions
|
@ -37,11 +37,6 @@ FGAIManager::FGAIManager() {
|
|||
}
|
||||
|
||||
FGAIManager::~FGAIManager() {
|
||||
ai_list_itr = ai_list.begin();
|
||||
while(ai_list_itr != ai_list.end()) {
|
||||
delete (*ai_list_itr);
|
||||
++ai_list_itr;
|
||||
}
|
||||
ai_list.clear();
|
||||
}
|
||||
|
||||
|
@ -123,8 +118,6 @@ void FGAIManager::update(double dt) {
|
|||
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);
|
||||
|
|
Loading…
Add table
Reference in a new issue