Mercurial > MadButterfly
diff src/redraw_man.c @ 151:d11aa8fc06c7
Fix bug of tanks do not show at right places.
Since we avoid to dirty a subtree if root of a subtree have been dirty or
hidden, it make children that was added into coord tree after a coord be
dirty do not be marked with COF_DIRTY flag. To fix it, when a new coord
is created, the parent is checked and mark new coord with COF_DIRTY flag
if the parent is dirty. It forces new coords to be cleaned and transformed
to right places.
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Fri, 26 Sep 2008 17:42:16 +0800 |
parents | 0824f4804ee0 |
children | 2b316b5d65f9 |
line wrap: on
line diff
--- a/src/redraw_man.c Thu Sep 25 23:44:38 2008 +0800 +++ b/src/redraw_man.c Fri Sep 26 17:42:16 2008 +0800 @@ -391,6 +391,10 @@ coord->before_pmem = parent->num_members; + /* If parent is dirty, children should be dirty. */ + if(parent && (parent->flags & COF_DIRTY)) + rdman_coord_changed(rdman, coord); + return coord; } @@ -449,15 +453,21 @@ if(coord->flags & COF_DIRTY) return OK; - - /* Make the coord and child coords dirty. */ - for(child = coord; + + make_sure_dirty_coords(rdman); + rdman->dirty_coords[rdman->n_dirty_coords++] = coord; + coord->flags |= COF_DIRTY; + + /* Make child coords dirty. */ + for(child = preorder_coord_subtree(coord, coord); child != NULL; child = preorder_coord_subtree(coord, child)) { - if(child->flags & COF_DIRTY) + if(child->flags & (COF_DIRTY | COF_HIDDEN)) { + preorder_coord_skip_subtree(child); continue; + } + make_sure_dirty_coords(rdman); - rdman->dirty_coords[rdman->n_dirty_coords++] = child; child->flags |= COF_DIRTY; }