From e19e7cad0c96227cb4a66baaa9ebc550e990affc Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 5 Mar 2023 23:31:20 +0900 Subject: [PATCH] [ecs] Invalidate entity before removing components It turns out that the fixes for other problems related to removing hierarchy reference components fixed the problem moving the entity invalidation fixed, and invalidating the entity late somehow broke the sprite renderer (at least in glsl). --- libs/ecs/ecs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libs/ecs/ecs.c b/libs/ecs/ecs.c index 0a4afaa04..af9870219 100644 --- a/libs/ecs/ecs.c +++ b/libs/ecs/ecs.c @@ -209,13 +209,13 @@ ECS_DelEntity (ecs_registry_t *registry, uint32_t ent) } uint32_t next = registry->next | Ent_NextGen (Ent_Generation (ent)); uint32_t id = Ent_Index (ent); + registry->entities[id] = next; + registry->next = id; + registry->available++; for (uint32_t i = 0; i < registry->components.size; i++) { Ent_RemoveComponent (ent, i, registry); } - registry->entities[id] = next; - registry->next = id; - registry->available++; } VISIBLE void