@@ -9299,51 +9299,6 @@ bool flecs_remove_invalid(
92999299 return true;
93009300}
93019301
9302- static
9303- ecs_table_t* flecs_cmd_batch_add_diff(
9304- ecs_world_t *world,
9305- ecs_table_t *dst,
9306- ecs_table_t *cur,
9307- ecs_table_t *prev)
9308- {
9309- int32_t p = 0, p_count = prev->type.count;
9310- int32_t c = 0, c_count = cur->type.count;
9311- ecs_id_t *p_ids = prev->type.array;
9312- ecs_id_t *c_ids = cur->type.array;
9313-
9314- for (; c < c_count;) {
9315- ecs_id_t c_id = c_ids[c];
9316- ecs_id_t p_id = p_ids[p];
9317-
9318- if (p_id < c_id) {
9319- /* Previous id no longer exists in new table, so it was removed */
9320- dst = ecs_table_remove_id(world, dst, p_id);
9321- }
9322- if (c_id < p_id) {
9323- /* Current id didn't exist in previous table, so it was added */
9324- dst = ecs_table_add_id(world, dst, c_id);
9325- }
9326-
9327- c += c_id <= p_id;
9328- p += p_id <= c_id;
9329- if (p == p_count) {
9330- break;
9331- }
9332- }
9333-
9334- /* Remainder */
9335- for (; p < p_count; p ++) {
9336- ecs_id_t p_id = p_ids[p];
9337- dst = ecs_table_remove_id(world, dst, p_id);
9338- }
9339- for (; c < c_count; c ++) {
9340- ecs_id_t c_id = c_ids[c];
9341- dst = ecs_table_add_id(world, dst, c_id);
9342- }
9343-
9344- return dst;
9345- }
9346-
93479302static
93489303void flecs_cmd_batch_for_entity(
93499304 ecs_world_t *world,
@@ -9414,43 +9369,6 @@ void flecs_cmd_batch_for_entity(
94149369 table = flecs_find_table_add(world, table, id, diff);
94159370 world->info.cmd.batched_command_count ++;
94169371 break;
9417- case EcsCmdModified: {
9418- /* If a modified was inserted for an existing component, the value
9419- * of the component could have been changed. If this is the case,
9420- * call on_set hooks before the OnAdd/OnRemove observers are invoked
9421- * when moving the entity to a different table.
9422- * This ensures that if OnAdd/OnRemove observers access the modified
9423- * component value, the on_set hook has had the opportunity to
9424- * run first to set any computed values of the component. */
9425- int32_t row = ECS_RECORD_TO_ROW(r->row);
9426- ecs_id_record_t *idr = flecs_id_record_get(world, cmd->id);
9427- const ecs_table_record_t *tr =
9428- flecs_id_record_get_table(idr, start_table);
9429- if (tr) {
9430- const ecs_type_info_t *ti = idr->type_info;
9431- ecs_iter_action_t on_set;
9432- if ((on_set = ti->hooks.on_set)) {
9433- ecs_table_t *prev_table = r->table;
9434- ecs_defer_begin(world);
9435- flecs_invoke_hook(world, start_table, tr, 1, row,
9436- &entity,cmd->id, ti, EcsOnSet, on_set);
9437- ecs_defer_end(world);
9438-
9439- /* Don't run on_set hook twice, but make sure to still
9440- * invoke observers. */
9441- cmd->kind = EcsCmdModifiedNoHook;
9442-
9443- /* If entity changed tables in hook, add difference to
9444- * destination table, so we don't lose the side effects
9445- * of the hook. */
9446- if (r->table != prev_table) {
9447- table = flecs_cmd_batch_add_diff(
9448- world, table, r->table, prev_table);
9449- }
9450- }
9451- }
9452- break;
9453- }
94549372 case EcsCmdSet:
94559373 case EcsCmdEnsure: {
94569374 ecs_id_t *ids = diff->added.array;
@@ -9505,6 +9423,7 @@ void flecs_cmd_batch_for_entity(
95059423 case EcsCmdEvent:
95069424 case EcsCmdSkip:
95079425 case EcsCmdModifiedNoHook:
9426+ case EcsCmdModified:
95089427 break;
95099428 }
95109429
@@ -16418,7 +16337,7 @@ bool flecs_defer_modified(
1641816337 ecs_id_t id)
1641916338{
1642016339 if (flecs_defer_cmd(stage)) {
16421- ecs_cmd_t *cmd = flecs_cmd_new_batched (stage, entity );
16340+ ecs_cmd_t *cmd = flecs_cmd_new (stage);
1642216341 if (cmd) {
1642316342 cmd->kind = EcsCmdModified;
1642416343 cmd->id = id;
@@ -67971,8 +67890,6 @@ ecs_var_id_t flecs_query_find_var_id(
6797167890 if (query->pub.flags & EcsQueryHasTableThisVar) {
6797267891 return 0;
6797367892 } else {
67974- printf("VARNONE\n");
67975- flecs_dump_backtrace(stdout);
6797667893 return EcsVarNone;
6797767894 }
6797867895 }
0 commit comments