diff options
Diffstat (limited to 'libdimension/object.c')
-rw-r--r-- | libdimension/object.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libdimension/object.c b/libdimension/object.c index a714f6e..d87eb12 100644 --- a/libdimension/object.c +++ b/libdimension/object.c @@ -40,6 +40,7 @@ dmnsn_new_object() object->texture = NULL; object->interior = NULL; object->trans = dmnsn_identity_matrix(); + object->children = dmnsn_new_array(sizeof(dmnsn_object *)); object->init_fn = NULL; object->free_fn = NULL; return object; @@ -50,6 +51,10 @@ void dmnsn_delete_object(dmnsn_object *object) { if (object) { + DMNSN_ARRAY_FOREACH (dmnsn_object **, child, object->children) { + dmnsn_delete_object(*child); + } + dmnsn_delete_array(object->children); dmnsn_delete_interior(object->interior); dmnsn_delete_texture(object->texture); if (object->free_fn) { |