Skip to content

Commit

Permalink
Add extra check to prevent bundler writes where we have nothing set
Browse files Browse the repository at this point in the history
  • Loading branch information
unitoftime committed Mar 6, 2025
1 parent 8a8920a commit 7d499c2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,8 @@ func (bun *Bundler) Remove(compId CompId) {
// }

func (b *Bundler) Write(world *World, id Id) {
if b.archMask == blankArchMask {
return // If the bundler is empty, just dont do anything
}
world.writeBundler(id, b)
}
7 changes: 7 additions & 0 deletions command.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,17 @@ func (c *singleCmd) apply(world *World) {
world.cmd.preWrite(EntityCommand{c})
}
c.bundler.Write(world, c.id) // TODO: This could probably use a Spawn function which would be faster
// if world.cmd.postWrite != nil {
// world.cmd.postWrite(c.id)
// }
case CmdTypeWrite:
if world.cmd.preWrite != nil {
world.cmd.preWrite(EntityCommand{c})
}
c.bundler.Write(world, c.id)
// if world.cmd.postWrite != nil {
// world.cmd.postWrite(c.id)
// }
case CmdTypeTrigger:
world.Trigger(c.event, c.id)
case CmdTypeDelete:
Expand All @@ -70,6 +76,7 @@ type EntityCommand struct {

func (e EntityCommand) Cancel() {
e.cmd.Type = CmdTypeNone
e.cmd.id = InvalidEntity
}

// Removes the supplied component type from this entity command.
Expand Down

0 comments on commit 7d499c2

Please sign in to comment.