# HG changeset patch # User Mike Becker # Date 1746388213 -7200 # Node ID 08548799ae4a4388692906dfcf6e65e088b5a248 # Parent d619bf7dd87bbd42aade454c3850eb3c8e58d66d use new UCX 3.2 cxListEmplace() diff -r d619bf7dd87b -r 08548799ae4a src/behavior.c --- a/src/behavior.c Sat May 03 19:48:57 2025 +0200 +++ b/src/behavior.c Sun May 04 21:50:13 2025 +0200 @@ -45,20 +45,18 @@ } AscBehavior *asc_behavior_add_impl(AscSceneNode *node, struct asc_behavior_create_args args) { - // TODO: replace cxListAdd() with cxListEmplace() when upgrading to UCX 3.2 - AscBehavior behavior = {0}; - behavior.node = node; - behavior.func = args.func; - behavior.destroy_func = args.destroy_func; - behavior.data = args.data; if (node->behaviors == NULL) { node->behaviors = asc_behavior_new_list(); } - if (cxListAdd(node->behaviors, &behavior)) { + AscBehavior *behavior = cxListEmplace(node->behaviors); + if (behavior == NULL) { // TODO: output ID of node once we have implemented that asc_error("Failed to add behavior to scene node."); return NULL; } - // TODO: replace with cxListLast() when upgrading to UCX 3.2 - return cxListAt(node->behaviors, cxListSize(node->behaviors) - 1); + behavior->node = node; + behavior->func = args.func; + behavior->destroy_func = args.destroy_func; + behavior->data = args.data; + return behavior; }