File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
crates/bevy_ecs/src/query Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -80,17 +80,20 @@ where
8080 }
8181
8282 pub fn new_archetype ( & mut self , archetype : & Archetype ) {
83- let table_index = archetype. table_id ( ) . index ( ) ;
8483 if self . fetch_state . matches_archetype ( archetype)
8584 && self . filter_state . matches_archetype ( archetype)
8685 {
8786 self . fetch_state
8887 . update_archetype_component_access ( archetype, & mut self . archetype_component_access ) ;
8988 self . filter_state
9089 . update_archetype_component_access ( archetype, & mut self . archetype_component_access ) ;
91- self . matched_archetypes . grow ( archetype. id ( ) . index ( ) + 1 ) ;
92- self . matched_archetypes . set ( archetype. id ( ) . index ( ) , true ) ;
93- self . matched_archetype_ids . push ( archetype. id ( ) ) ;
90+ let archetype_index = archetype. id ( ) . index ( ) ;
91+ if !self . matched_archetypes . contains ( archetype_index) {
92+ self . matched_archetypes . grow ( archetype_index + 1 ) ;
93+ self . matched_archetypes . set ( archetype_index, true ) ;
94+ self . matched_archetype_ids . push ( archetype. id ( ) ) ;
95+ }
96+ let table_index = archetype. table_id ( ) . index ( ) ;
9497 if !self . matched_tables . contains ( table_index) {
9598 self . matched_tables . grow ( table_index + 1 ) ;
9699 self . matched_tables . set ( table_index, true ) ;
You can’t perform that action at this time.
0 commit comments