Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsafe API, preparations #80

Merged
merged 4 commits into from
Feb 28, 2025
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
4 changes: 2 additions & 2 deletions ecs/archetype.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (a *archetype) HasRelations() bool {
return a.numRelations > 0
}

func (a *archetype) GetTable(storage *storage, relations []relationID) (*table, bool) {
func (a *archetype) GetTable(storage *storage, relations []RelationID) (*table, bool) {
if len(a.tables) == 0 {
return nil, false
}
Expand All @@ -77,7 +77,7 @@ func (a *archetype) GetTable(storage *storage, relations []relationID) (*table,
return nil, false
}

func (a *archetype) GetTables(relations []relationID) []tableID {
func (a *archetype) GetTables(relations []RelationID) []tableID {
if !a.HasRelations() {
return a.tables
}
Expand Down
4 changes: 2 additions & 2 deletions ecs/entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ func (e Entity) isWildcard() bool {
return e.id == 1
}

func (e Entity) toRelation(id ID, out []relationID) []relationID {
func (e Entity) toRelation(id ID, out []RelationID) []RelationID {
out = out[:0]
out = append(out, relationID{
out = append(out, RelationID{
component: id,
target: Entity(e),
})
Expand Down
16 changes: 8 additions & 8 deletions ecs/exchange_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions ecs/filter_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ecs/generate/exchange.go.template
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type Exchange{{.}}{{$generics}} struct {
world *World
ids []ID
remove []ID
relations []relationID
relations []RelationID
}

// NewExchange{{.}} creates an [Exchange{{.}}].
Expand Down
2 changes: 1 addition & 1 deletion ecs/generate/filter.go.template
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type Filter{{.}}{{$generics}} struct {
ids []ID
mask Mask
without Mask
relations []relationID
relations []RelationID
}

// NewFilter{{.}} creates a new [Filter{{.}}].
Expand Down
2 changes: 1 addition & 1 deletion ecs/generate/maps.go.template
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type Map{{.}}{{$generics}} struct {
{{- range $upper}}
storage{{.}} *componentStorage
{{- end}}
relations []relationID
relations []RelationID
}

// NewMap{{.}} creates a new [Map{{.}}].
Expand Down
4 changes: 2 additions & 2 deletions ecs/generate/query.go.template
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type Query{{.}}{{$generics}} struct {
world *World
mask Mask
without Mask
relations []relationID
relations []RelationID
lock uint8
cursor cursor
tables []tableID
Expand All @@ -42,7 +42,7 @@ type Query{{.}}{{$generics}} struct {
hasWithout bool
}

func newQuery{{.}}{{$generics}}(world *World, mask Mask, without Mask{{if .}}, ids []ID{{end}}, relations []relationID) Query{{.}}{{$genericsShort}} {
func newQuery{{.}}{{$generics}}(world *World, mask Mask, without Mask{{if .}}, ids []ID{{end}}, relations []RelationID) Query{{.}}{{$genericsShort}} {
components := make([]*componentStorage, {{.}})
{{if .}}for i := range {{.}} {
components[i] = &world.storage.components[ids[i].id]
Expand Down
2 changes: 1 addition & 1 deletion ecs/map.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type Map[T any] struct {
world *World
id ID
storage *componentStorage
relations []relationID
relations []RelationID
}

// NewMap creates a new [Map].
Expand Down
16 changes: 8 additions & 8 deletions ecs/maps_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading