Mercurial > MadButterfly
comparison 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 |
comparison
equal
deleted
inserted
replaced
150:0824f4804ee0 | 151:d11aa8fc06c7 |
---|---|
389 } | 389 } |
390 } | 390 } |
391 | 391 |
392 coord->before_pmem = parent->num_members; | 392 coord->before_pmem = parent->num_members; |
393 | 393 |
394 /* If parent is dirty, children should be dirty. */ | |
395 if(parent && (parent->flags & COF_DIRTY)) | |
396 rdman_coord_changed(rdman, coord); | |
397 | |
394 return coord; | 398 return coord; |
395 } | 399 } |
396 | 400 |
397 /*! \brief Free a coord of a redraw_man_t object. | 401 /*! \brief Free a coord of a redraw_man_t object. |
398 * | 402 * |
447 int rdman_coord_changed(redraw_man_t *rdman, coord_t *coord) { | 451 int rdman_coord_changed(redraw_man_t *rdman, coord_t *coord) { |
448 coord_t *child; | 452 coord_t *child; |
449 | 453 |
450 if(coord->flags & COF_DIRTY) | 454 if(coord->flags & COF_DIRTY) |
451 return OK; | 455 return OK; |
452 | 456 |
453 /* Make the coord and child coords dirty. */ | 457 make_sure_dirty_coords(rdman); |
454 for(child = coord; | 458 rdman->dirty_coords[rdman->n_dirty_coords++] = coord; |
459 coord->flags |= COF_DIRTY; | |
460 | |
461 /* Make child coords dirty. */ | |
462 for(child = preorder_coord_subtree(coord, coord); | |
455 child != NULL; | 463 child != NULL; |
456 child = preorder_coord_subtree(coord, child)) { | 464 child = preorder_coord_subtree(coord, child)) { |
457 if(child->flags & COF_DIRTY) | 465 if(child->flags & (COF_DIRTY | COF_HIDDEN)) { |
466 preorder_coord_skip_subtree(child); | |
458 continue; | 467 continue; |
468 } | |
469 | |
459 make_sure_dirty_coords(rdman); | 470 make_sure_dirty_coords(rdman); |
460 | |
461 rdman->dirty_coords[rdman->n_dirty_coords++] = child; | 471 rdman->dirty_coords[rdman->n_dirty_coords++] = child; |
462 child->flags |= COF_DIRTY; | 472 child->flags |= COF_DIRTY; |
463 } | 473 } |
464 | 474 |
465 return OK; | 475 return OK; |