From: Thomas Geymayer Date: Tue, 18 Jun 2013 21:07:20 +0000 (+0200) Subject: Canvas: fix updating placements after non matching placements X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=c391fcd345dab0ee2f53947d2e91256b1f979980;p=simgear.git Canvas: fix updating placements after non matching placements --- diff --git a/simgear/canvas/Canvas.cxx b/simgear/canvas/Canvas.cxx index 25345e76..8c876a4c 100644 --- a/simgear/canvas/Canvas.cxx +++ b/simgear/canvas/Canvas.cxx @@ -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 ) {