From b45620544427306854a28a5163fafd45b007acc2 Mon Sep 17 00:00:00 2001 From: physick Date: Mon, 31 Aug 2026 03:46:59 +0500 Subject: puzzle collection selection --- src/puzzles/collection.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/puzzles/collection.c') diff --git a/src/puzzles/collection.c b/src/puzzles/collection.c index 71eaadf..ca2743c 100644 --- a/src/puzzles/collection.c +++ b/src/puzzles/collection.c @@ -151,7 +151,7 @@ void InitializeCollection(CollectionElement *el, void (*callback)(CollectionElem initCollectionFromDir(el, callback); break; default: - TraceLog(LOG_WARNING, "Invalid CollectionElement type"); + TraceLog(LOG_WARNING, "Invalid CollectionElement type for %s", el->path); break; } } @@ -191,3 +191,15 @@ void UpdateCollectionElement(CollectionElement *el) { } } } + +void DeinitCollectionElement(CollectionElement *el) { + if (el == NULL || !el->IsInitialized) return; + if (el->path != NULL) free(el->path); + if (el->name != NULL) free(el->name); + if (el->hasIcon) UnloadTexture(el->icon); + + for (size_t i = 0; i < el->childCount; ++i) { + DeinitCollectionElement(&el->children[i]); + } + free(el); +} -- cgit v1.3