Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entities are being incorrectly added to the index #28

Closed
ayebear opened this issue Apr 9, 2018 · 0 comments
Closed

Entities are being incorrectly added to the index #28

ayebear opened this issue Apr 9, 2018 · 0 comments
Assignees
Labels

Comments

@ayebear
Copy link
Owner

ayebear commented Apr 9, 2018

When setting components after multi-component indexes have already been created, all the entities with a single component match will be added to each group. This should instead only add entities that contain ALL of the components in the group.

Example of test that should succeed:

let world = new World()
world.entity().set('a').set('b')
assert(world.get('a', 'b').length === 1)
world.get('a', 'b')[0].destroy()
assert(world.get('a', 'b').length === 0)
world.entity().set('a')
assert(world.get('a', 'b').length === 0)
// This throws an assertion error: length is 1, because by creating the entity above, it falsely added it to the index.

// The rest of the test, even though it doesn't even make it here:
world.entity().set('b')
assert(world.get('a', 'b').length === 0)
world.entity().set('b').set('a')
assert(world.get('a', 'b').length === 1)
@ayebear ayebear added the bug label Apr 9, 2018
@ayebear ayebear self-assigned this Apr 9, 2018
@ayebear ayebear closed this as completed in 18086b0 Apr 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant