Chained feat prereq wiki visibility fix
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user