Chained feat prereq wiki visibility fix

This commit is contained in:
2026-05-21 16:09:13 +02:00
parent 23ef63ca7b
commit d0e5e42090
2 changed files with 81 additions and 12 deletions
+26 -12
View File
@@ -187,21 +187,35 @@ func (ctx *wikiContext) buildWikiVisibilityIndex(policy *wikiVisibilityDefinitio
}
}
referenceSets := ctx.collectWikiVisibilityReferenceSets(policy, visible)
for _, dataset := range []string{"classes", "racialtypes", "skills", "spells", "baseitems", "feat"} {
definition, ok := policy.Datasets[dataset]
if !ok {
continue
}
rows := ctx.wikiRowsForDataset(dataset)
for _, key := range sortedKeys(rows) {
include, err := ctx.evaluateWikiVisibility(dataset, key, rows[key], definition, referenceSets)
if err != nil {
return nil, err
previousVisible := ctx.visibleWikiKeys
ctx.visibleWikiKeys = visible
defer func() {
ctx.visibleWikiKeys = previousVisible
}()
for pass := 0; pass <= len(visible); pass++ {
changed := false
for _, dataset := range []string{"classes", "racialtypes", "skills", "spells", "baseitems", "feat"} {
definition, ok := policy.Datasets[dataset]
if !ok {
continue
}
visible[key] = include
rows := ctx.wikiRowsForDataset(dataset)
for _, key := range sortedKeys(rows) {
include, err := ctx.evaluateWikiVisibility(dataset, key, rows[key], definition, referenceSets)
if err != nil {
return nil, err
}
if visible[key] != include {
changed = true
}
visible[key] = include
}
}
if !changed {
return visible, nil
}
}
return visible, nil
return nil, fmt.Errorf("wiki visibility index did not converge")
}
func (ctx *wikiContext) evaluateWikiVisibilityWithoutSets(dataset, key string, row map[string]any, definition wikiVisibilityDataset) (bool, error) {