Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion component.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func AddComponent[T ComponentInterface](world *World, entityId EntityId, compone
return fmt.Errorf("the entity %d already owns the component %d", entityId, componentId)
}

archetype := world.getNextArchetype(entityRecord, world.getComponentsIds(component)...)
archetype := world.archetypeAfterAdd(entityRecord.archetypeId, componentId)
err := addComponentsToArchetype1(world, entityRecord, archetype, component)
if err != nil {
return fmt.Errorf("the component %d cannot be added to entity %d: %w", componentId, entityId, err)
Expand Down
2 changes: 1 addition & 1 deletion register.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (componentConfig *ComponentConfig[T]) addComponent(world *World, entityId E
componentConfig.builderFn(&t, configuration)

entityRecord := world.entities[entityId.Index()]
archetype := world.getNextArchetype(entityRecord, componentConfig.id)
archetype := world.archetypeAfterAdd(entityRecord.archetypeId, componentConfig.id)
err := addComponentsToArchetype1[T](world, entityRecord, archetype, t)

return err
Expand Down
2 changes: 1 addition & 1 deletion tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (world *World) AddTag(tagId TagId, entityId EntityId) error {
}

entityRecord := world.entities[entityId.Index()]
archetype := world.getNextArchetype(entityRecord, tagId)
archetype := world.archetypeAfterAdd(entityRecord.archetypeId, tagId)

oldArchetype := world.getArchetype(entityRecord)
if archetype.Id != oldArchetype.Id {
Expand Down
Loading