]> git.mxchange.org Git - flightgear.git/commitdiff
Some small updates
authorehofman <ehofman>
Fri, 28 Nov 2003 20:05:32 +0000 (20:05 +0000)
committerehofman <ehofman>
Fri, 28 Nov 2003 20:05:32 +0000 (20:05 +0000)
src/AIModel/AIBase.cxx
src/AIModel/AIManager.cxx

index 7c476180f951e37c77345967bb6fb853cc7cb20a..11b17dc412c190632d08d11c7cf888dcecd42887 100644 (file)
@@ -63,6 +63,7 @@ bool FGAIBase::init() {
    } 
 
    tgt_roll = tgt_pitch = tgt_yaw = tgt_vs = vs = roll = pitch = 0.0;
+   setDie(false);
 }
 
 
index 2d68fc3d98aff8508a2e8e04bd007b1bb1527d40..08c215aa7ed3642cbae26194ed9ca499d042eb84 100644 (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;
-       }
+        }
 }