diff --git a/ecs/src/updates.rs b/ecs/src/updates.rs index 2be4088..b8a957e 100644 --- a/ecs/src/updates.rs +++ b/ecs/src/updates.rs @@ -176,7 +176,7 @@ impl Archetype { } // check if one of the queries could not be fullfilled - for queryable_entities in complying_entities { + for queryable_entities in complying_entities.iter() { if queryable_entities.is_empty() { return Ok(()); } @@ -292,4 +292,4 @@ impl_update_filter!(Nonuple, [R, r], [S, s], [T, t], [U, u], [V, v], [W, w], #[rustfmt::skip] impl_update_filter!(Decuple, [R, r], [S, s], [T, t], [U, u], [V, v], [W, w], [X, x], [Y, y], [Z, z], [A, a]); -implement_updates!(8); +implement_updates!(5, 5); diff --git a/update_macros/src/lib.rs b/update_macros/src/lib.rs index 1ca0ef8..82b848e 100644 --- a/update_macros/src/lib.rs +++ b/update_macros/src/lib.rs @@ -17,13 +17,19 @@ use syn::{ struct UpdateInfo { max_components: usize, + max_resources: usize, } impl Parse for UpdateInfo { fn parse(input: ParseStream) -> Result { let max_components = input.parse::()?.base10_parse()?; + input.parse::()?; + let max_resources = input.parse::()?.base10_parse()?; - Ok(Self { max_components }) + Ok(Self { + max_components, + max_resources, + }) } } @@ -31,7 +37,7 @@ impl Parse for UpdateInfo { pub fn implement_updates(input: TokenStream) -> TokenStream { let input = parse_macro_input!(input as UpdateInfo); - update(input.max_components) + update(input.max_components, input.max_resources) } struct InputInfo { diff --git a/update_macros/src/update.rs b/update_macros/src/update.rs index b75fd75..4821c33 100644 --- a/update_macros/src/update.rs +++ b/update_macros/src/update.rs @@ -153,7 +153,6 @@ struct Update { impl Update { const MIN_RESOURCE: usize = 0; - const MAX_RESOURCE: usize = 10; const MIN_COMPONENTS: usize = 1; pub fn new(queries: impl Iterator, resources: usize) -> Self { @@ -454,7 +453,7 @@ impl ToTokens for Update { } } -pub fn update(max_components: usize) -> TokenStream { +pub fn update(max_components: usize, max_resources: usize) -> TokenStream { let mut queries: Vec> = Vec::new(); for c in Update::MIN_COMPONENTS..=max_components { @@ -477,7 +476,7 @@ pub fn update(max_components: usize) -> TokenStream { let mut resources = Vec::new(); - for resource in Update::MIN_RESOURCE..Update::MAX_RESOURCE { + for resource in Update::MIN_RESOURCE..=max_resources { resources.push(resource); }