Check for all possible query conflicts in initialization #1384
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #1320.
This should panic whenever a system is created that could possibly cause a conflict with some archetype. It does this by first checking if there are any conflicting accesses at all (basically test if any of the used types overlap) and then testing the conflicting queries with all possible combinations of components. This way the check should be relatively fast most of the time and get into exponential runtime only when necessary. Also this check is only performed once at startup, so performance is not too essential.
Some things that maybe should be changed:
SystemState::check_access
ininitialize
andupdate
. Maybe it would be better to split the two cases.QueryAccess::get_access_filtered
. This allows the method to be called with a real archetype or just a combination of components