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

Fix relationship example by specifying inout. #1107

Conversation

garrett-is-a-swann
Copy link
Contributor

Fixes an example that is currently broken due to a change where .with requests no data by default.

Another fix could have been to use .term instead, but it's useful to see .with and access modifiers in action.

@SanderMertens
Copy link
Owner

Ah yeah, that example is broken because of a breaking change a while back. Since the code doesn't actually modify the entity arrays (which should not be allowed, should add a check for that), it should be modified to this:

    flecs::query<> q = ecs.query_builder()
        .with(Walking).in()
        .with<Direction>(flecs::Wildcard).in()
        .build();

// ...

        auto movement = it.field<const flecs::entity_t>(1);
        auto direction = it.field<const flecs::entity_t>(2);

@garrett-is-a-swann
Copy link
Contributor Author

Oops, duh. Had it backwards. Will make those changes.

@SanderMertens
Copy link
Owner

LGTM, thanks for the PR!

@SanderMertens SanderMertens merged commit 8338529 into SanderMertens:master Dec 29, 2023
66 checks passed
@garrett-is-a-swann garrett-is-a-swann deleted the fix-example-cpp-relationship-union branch December 30, 2023 04:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants