From 4674a25f40840bba569832423773e9dd5b130ce6 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Fri, 4 Nov 2022 23:52:39 -0700 Subject: libix3: fix depth maintenance precedence *depth-- should be (*depth)-- etc. Basically repeating the same fix I just made in libix2 as the share a common ancestry --- src/ix3.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/ix3.c') diff --git a/src/ix3.c b/src/ix3.c index 81a71c3..3cdc5d1 100644 --- a/src/ix3.c +++ b/src/ix3.c @@ -426,7 +426,7 @@ static ix3_object_t * add_object(ix3_t *ix3, unsigned *depth, ix3_node_t *node, bb3f_t octrants[8]; int i; - *depth++; + (*depth)++; init_octrants(octrants, node_aabb, &node->center); for (i = 0; i < 8; i++) { if (!aabb_overlap(NULL, NULL, &octrants[i], &object->position, &object->origin, &object->aabb)) @@ -435,7 +435,7 @@ static ix3_object_t * add_object(ix3_t *ix3, unsigned *depth, ix3_node_t *node, if (!add_object(ix3, depth, &node->children[i], &octrants[i], object, reference_cache)) goto _fail; } - *depth--; + (*depth)--; return object; } @@ -446,10 +446,10 @@ static ix3_object_t * add_object(ix3_t *ix3, unsigned *depth, ix3_node_t *node, /* If the node is overflowing, split it */ if (node->n_objects > ix3->max_per_node && *depth < ix3->max_depth) { - *depth++; + (*depth)++; if (!split_node(ix3, depth, node, node_aabb)) goto _fail; - *depth--; + (*depth)--; } return object; -- cgit v1.2.3