- /* Only draw children if possible */
- gboolean has_all_children = TRUE;
- GritsTile *child;
- grits_tile_foreach(tile, child)
- if (!child || !child->data || GRITS_OBJECT(child)->hidden)
- has_all_children = FALSE;
-
- /* Draw parent tile underneath */
- if (!has_all_children) {
- GList *triangles = roam_sphere_get_intersect(opengl->sphere, FALSE,
- tile->edge.n, tile->edge.s, tile->edge.e, tile->edge.w);
- grits_tile_draw_one(tile, opengl, triangles);
- g_list_free(triangles);
- }
+ GritsTile *child = NULL;
+ gboolean done = FALSE;
+ while (!done) {
+ /* Only draw children if possible */
+ gboolean draw_parent = FALSE;
+ grits_tile_foreach(tile, child)
+ if (!child || !child->data || GRITS_OBJECT(child)->hidden)
+ draw_parent = TRUE;
+
+ /* Draw parent tile underneath */
+ if (draw_parent) {
+ GList *triangles = roam_sphere_get_intersect(opengl->sphere, FALSE,
+ tile->edge.n, tile->edge.s, tile->edge.e, tile->edge.w);
+ grits_tile_draw_one(tile, opengl, triangles);
+ g_list_free(triangles);
+ }