[ecs] Support adding null hierarchies to non-root

As an implementation detail, inserting null hierarchies (src hierarchy
is null) is supported for ease of hierarchy construction from data. No
component data is copied, only the child and parent indices and counts
are updated.
This commit is contained in:
Bill Currie 2022-10-27 19:46:28 +09:00
parent 52b09e81cd
commit 80c0beff89

View file

@ -271,7 +271,9 @@ Hierarchy_InsertHierarchy (hierarchy_t *dst, const hierarchy_t *src,
Sys_Error ("attempt to insert root in non-empty hierarchy");
}
hierarchy_open (dst, 0, 1);
if (src) {
hierarchy_move (dst, src, 0, srcRoot, 1);
}
dst->parentIndex[0] = nullent;
dst->childIndex[0] = 1;
dst->childCount[0] = 0;