mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-31 13:10:34 +00:00
[ecs] Invalidate entity in hierarchy before removal
I'm not sure just what was going on other than *other* components were getting double-removed when the hierarchy reference component was removed when the entity was being deleted. This might even prevent issues with removing the hierarchy from an entity that's not being deleted as the pre-invalidation prevents the removal from deleting the entity.
This commit is contained in:
parent
f12b3ea134
commit
00d1ae0b91
2 changed files with 4 additions and 0 deletions
|
@ -205,6 +205,9 @@ ECS_NewEntity (ecs_registry_t *registry)
|
|||
VISIBLE void
|
||||
ECS_DelEntity (ecs_registry_t *registry, uint32_t ent)
|
||||
{
|
||||
if (!ECS_EntValid (ent, registry)) {
|
||||
return;
|
||||
}
|
||||
if (registry->locked) {
|
||||
// the registry is being deleted and mass entity and component
|
||||
// deletions are going on
|
||||
|
|
|
@ -482,6 +482,7 @@ Hierref_DestroyComponent (void *href)
|
|||
{
|
||||
hierref_t ref = *(hierref_t *) href;
|
||||
if (ref.hierarchy) {
|
||||
ref.hierarchy->ent[ref.index] = -1;
|
||||
Hierarchy_RemoveHierarchy (ref.hierarchy, ref.index, 1);
|
||||
if (!ref.hierarchy->num_objects) {
|
||||
Hierarchy_Delete (ref.hierarchy);
|
||||
|
|
Loading…
Reference in a new issue