@@ -330,104 +330,17 @@ ecs_id_t flecs_query_op_get_id(
330330}
331331
332332int16_t flecs_query_next_column (
333+ const ecs_world_t * world ,
333334 ecs_table_t * table ,
334335 ecs_id_t id ,
335336 int32_t column )
336337{
337- if (!ECS_IS_PAIR (id ) || (ECS_PAIR_FIRST (id ) != EcsWildcard )) {
338- column = column + 1 ;
339- } else {
340- ecs_assert (column >= 0 , ECS_INTERNAL_ERROR , NULL );
341- column = ecs_search_offset (NULL , table , column + 1 , id , NULL );
342- ecs_assert (column != -1 , ECS_INTERNAL_ERROR , NULL );
343- }
338+ ecs_assert (column >= 0 , ECS_INTERNAL_ERROR , NULL );
339+ column = ecs_search_offset (world , table , column + 1 , id , NULL );
340+ ecs_assert (column != -1 , ECS_INTERNAL_ERROR , NULL );
344341 return flecs_ito (int16_t , column );
345342}
346343
347- static
348- bool flecs_component_inherits_from (
349- const ecs_world_t * world ,
350- ecs_entity_t component ,
351- ecs_entity_t base ,
352- int32_t depth )
353- {
354- if (depth >= FLECS_DAG_DEPTH_MAX ) {
355- return false;
356- }
357-
358- ecs_record_t * r = flecs_entities_get (world , component );
359- if (!r ) {
360- return false;
361- }
362-
363- ecs_table_t * table = r -> table ;
364- if (!table || !(table -> flags & EcsTableHasIsA )) {
365- return false;
366- }
367-
368- const ecs_table_record_t * tr_isa = flecs_component_get_table (
369- world -> cr_isa_wildcard , table );
370- if (!tr_isa ) {
371- return false;
372- }
373-
374- ecs_id_t * ids = table -> type .array ;
375- int32_t i = tr_isa -> index , end = i + tr_isa -> count ;
376- for (; i < end ; i ++ ) {
377- ecs_entity_t b = ecs_pair_second (world , ids [i ]);
378- if (b == base ) {
379- return true;
380- }
381- if (flecs_component_inherits_from (world , b , base , depth + 1 )) {
382- return true;
383- }
384- }
385-
386- return false;
387- }
388-
389- int16_t flecs_query_next_inherited_column (
390- const ecs_world_t * world ,
391- ecs_table_t * table ,
392- ecs_id_t base ,
393- int32_t column )
394- {
395- ecs_id_t * ids = table -> type .array ;
396- int32_t i , count = table -> type .count ;
397-
398- if (ECS_IS_PAIR (base )) {
399- ecs_entity_t base_rel = ecs_pair_first (world , base );
400- ecs_entity_t tgt = ECS_PAIR_SECOND (base );
401- bool any_tgt = (tgt == EcsWildcard ) || (tgt == EcsAny );
402- for (i = column + 1 ; i < count ; i ++ ) {
403- ecs_id_t id = ids [i ];
404- if (!ECS_IS_PAIR (id )) {
405- continue ;
406- }
407- if (!any_tgt && (ECS_PAIR_SECOND (id ) != tgt )) {
408- continue ;
409- }
410- if (flecs_component_inherits_from (
411- world , ecs_pair_first (world , id ), base_rel , 0 ))
412- {
413- return flecs_ito (int16_t , i );
414- }
415- }
416- } else {
417- for (i = column + 1 ; i < count ; i ++ ) {
418- ecs_id_t id = ids [i ];
419- if (id & ECS_ID_FLAGS_MASK ) {
420- continue ;
421- }
422- if (flecs_component_inherits_from (world , id , base , 0 )) {
423- return flecs_ito (int16_t , i );
424- }
425- }
426- }
427-
428- ecs_abort (ECS_INTERNAL_ERROR , NULL );
429- }
430-
431344void flecs_query_it_set_tr (
432345 ecs_iter_t * it ,
433346 int32_t field_index ,
0 commit comments