1
0
Fork 0

Don't destroy the elements ourselves. Instead clear

() calls the destructor for each element itself.
This commit is contained in:
ehofman 2003-11-28 20:16:59 +00:00
parent 3297ac3544
commit a9c6ca26af

View file

@ -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);