Fix shadowing bug in rules engine.
This commit is contained in:
parent
d13e04e2f4
commit
2c2e68ff93
@ -141,7 +141,7 @@ func (r *RuleCollection[C]) performInsert(k *keyedRule[C]) {
|
|||||||
r.rules[k.id] = k
|
r.rules[k.id] = k
|
||||||
|
|
||||||
s := r.byStep[k.Step()]
|
s := r.byStep[k.Step()]
|
||||||
if s == nil {
|
if len(s) == 0 {
|
||||||
r.steps = nil
|
r.steps = nil
|
||||||
}
|
}
|
||||||
s = append(s, k.id)
|
s = append(s, k.id)
|
||||||
@ -326,7 +326,7 @@ func (r *RuleCollection[C]) Run(p *Player[C]) error {
|
|||||||
steps := r.steps
|
steps := r.steps
|
||||||
if steps == nil {
|
if steps == nil {
|
||||||
// Step set changed, recalculate.
|
// Step set changed, recalculate.
|
||||||
steps := make([]int, 0, len(r.byStep))
|
steps = make([]int, 0, len(r.byStep))
|
||||||
for step := range r.byStep {
|
for step := range r.byStep {
|
||||||
steps = append(steps, step)
|
steps = append(steps, step)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user