diff options
author | Aaron Patterson <[email protected]> | 2023-10-24 12:20:46 -0700 |
---|---|---|
committer | Aaron Patterson <[email protected]> | 2023-10-24 14:23:17 -0700 |
commit | cfd7c1a2763d727f8a578da27317b55111aa6894 (patch) | |
tree | f1bd562e1c4fa82a727780fdbd53caf9e595b41d /shape.c | |
parent | 3760baccac55a03b850072ba7daf611ed8883687 (diff) |
Allow the shape tree to be traversed
This commit allows the shape tree to be traversed to locate an existing
shape, but it doesn't necessarily allow you to create new variations.
Diffstat (limited to 'shape.c')
-rw-r--r-- | shape.c | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -435,7 +435,7 @@ rb_shape_alloc_new_child(ID id, rb_shape_t * shape, enum shape_type shape_type) } static rb_shape_t* -get_next_shape_internal(rb_shape_t * shape, ID id, enum shape_type shape_type, bool * variation_created, bool new_shapes_allowed) +get_next_shape_internal(rb_shape_t * shape, ID id, enum shape_type shape_type, bool * variation_created, bool new_variations_allowed) { rb_shape_t *res = NULL; @@ -444,7 +444,7 @@ get_next_shape_internal(rb_shape_t * shape, ID id, enum shape_type shape_type, b *variation_created = false; - if ((new_shapes_allowed && (GET_SHAPE_TREE()->next_shape_id <= MAX_SHAPE_ID))) { + if (GET_SHAPE_TREE()->next_shape_id <= MAX_SHAPE_ID) { RB_VM_LOCK_ENTER(); { // If the current shape has children @@ -478,10 +478,12 @@ get_next_shape_internal(rb_shape_t * shape, ID id, enum shape_type shape_type, b // we know we need a new child shape, and that we must insert // it in to the table. if (!res) { - *variation_created = true; - rb_shape_t * new_shape = rb_shape_alloc_new_child(id, shape, shape_type); - rb_id_table_insert(shape->edges, id, (VALUE)new_shape); - res = new_shape; + if (new_variations_allowed) { + *variation_created = true; + rb_shape_t * new_shape = rb_shape_alloc_new_child(id, shape, shape_type); + rb_id_table_insert(shape->edges, id, (VALUE)new_shape); + res = new_shape; + } } } else { |