diff options
Diffstat (limited to 'src/puzzles/collection.c')
| -rw-r--r-- | src/puzzles/collection.c | 14 |
1 files changed, 13 insertions, 1 deletions
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); +} |
