This commit is contained in:
Josh Deprez 2021-09-21 17:13:32 +10:00
parent 6e771cd3f2
commit 05460a0491

View file

@ -81,7 +81,7 @@ func (g *Game) updateRecursive(c interface{}) error {
}
}
}
if c == g {
if c == g { // prevent infinite recursion
return nil
}
if u, ok := c.(Updater); ok {
@ -134,7 +134,8 @@ func (g *Game) PathUnregister(component interface{}) {
}
}
// Path returns a slice with the path of components to reach component from g.
// Path returns a slice with the path of components to reach component from g
// (including g and component).
func (g *Game) Path(component interface{}) []interface{} {
stack := g.ReversePath(component)
for i, j := 0, len(stack)-1; i < j; i, j = i+1, j-1 {