Closed Handsome-cong closed 4 months ago
Sorry for the late reply. You know, holiday break. 🙂
Can I ask you why you said that _may fail to index entity because of swap_elements
_ in your original message?
I don't get where swap_elements
enters the game in your reasoning below. Thanks.
In the example above, when calling the each
method on pos_group_with_health
, entity will be retrieved from the pool of Position
(through this code). At this point, an entity with a value of 1 will be retrieved. Entt will then try to use this entity to retrieve Health
, which obviously cannot succeed.
Bug confirmed. I'll push a fix upstream soon too. I'd say it's eligible for the first v3.13 patch release probably. 👍
Fix available on branches wip
and v3.13.x
(next patch release for version 3.13).
Let me know if it doesn't work for you. Thanks. 👍
Just tried it out and it looks like it works fine for me. Well done.
Also fixes the issue for me, thank you! 👍 (I had reported it on Discord with this test case: https://godbolt.org/z/joov57173)
Fixed with version 3.13.1, thanks for pointing this out.
When a partial-owning group relies on components owned by another group which relies on other components,
sparse_set
may fail to index entity because ofswap_elements
.This works fine before v3.12.0, but it gives an error here currently.
Maybe a picture would explain what happened better: