]> git.mxchange.org Git - simgear.git/commitdiff
Canvas: fix updating placements after non matching placements
authorThomas Geymayer <tomgey@gmail.com>
Tue, 18 Jun 2013 21:07:20 +0000 (23:07 +0200)
committerThomas Geymayer <tomgey@gmail.com>
Tue, 18 Jun 2013 21:07:20 +0000 (23:07 +0200)
simgear/canvas/Canvas.cxx

index 25345e761744ff74d722532acf25bc728d0ac86a..8c876a4cc84206fa77fcec1d78e712544ed66344 100644 (file)
@@ -466,21 +466,26 @@ namespace canvas
     if(    node->getParent()->getParent() == _node
         && node->getParent()->getNameString() == "placement" )
     {
-      bool placement_dirty = false;
-      BOOST_FOREACH(Placements& placements, _placements)
+      size_t index = node->getIndex();
+      if( index < _placements.size() )
       {
-        BOOST_FOREACH(PlacementPtr& placement, placements)
+        Placements& placements = _placements[index];
+        if( !placements.empty() )
         {
-          // check if change can be directly handled by placement
-          if(    placement->getProps() == node->getParent()
-              && !placement->childChanged(node) )
-            placement_dirty = true;
+          bool placement_dirty = false;
+          BOOST_FOREACH(PlacementPtr& placement, placements)
+          {
+            // check if change can be directly handled by placement
+            if(    placement->getProps() == node->getParent()
+                && !placement->childChanged(node) )
+              placement_dirty = true;
+          }
+
+          if( !placement_dirty )
+            return;
         }
       }
 
-      if( !placement_dirty )
-        return;
-
       // prevent double updates...
       for( size_t i = 0; i < _dirty_placements.size(); ++i )
       {