diff options
| author | historia <[not public]> | 2026-09-19 03:15:59 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-19 03:15:59 -0400 |
| commit | 0e60567a7a0addb9421769ee7be7853bfa8788cb (patch) | |
| tree | 7645112db0e4eae95b8a83c1e4f9aab38bede655 /internal/validate/validate.go | |
| parent | cc33072eced3d5460512c09c42ec4531c807d7af (diff) | |
| download | thehouseoficarus-0e60567a7a0addb9421769ee7be7853bfa8788cb.tar.gz | |
refactor: simplifcation, change how rooms are stored in player yaml, remove legacy code
Diffstat (limited to 'internal/validate/validate.go')
| -rw-r--r-- | internal/validate/validate.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/internal/validate/validate.go b/internal/validate/validate.go index a7ce1b0..dbcf06f 100644 --- a/internal/validate/validate.go +++ b/internal/validate/validate.go @@ -110,6 +110,7 @@ func Run(s Source) []Issue { issues = append(issues, validateDropTables(s)...) issues = append(issues, validateCourses(s)...) issues = append(issues, validateRoomTriggers(s)...) + issues = append(issues, validateFlagTriggerFiles(s)...) issues = append(issues, validateTechs(s)...) issues = append(issues, validateRoomWiring(s)...) issues = append(issues, validateModuleDestinations(s)...) @@ -127,13 +128,21 @@ func validateRoomFilenames(dataDir string) []Issue { dir := filepath.Join(dataDir, "rooms") var issues []Issue if err := behavior.WalkYAMLDir(dir, func(path, id string, data []byte) error { - if _, err := strconv.Atoi(id); err != nil { + n, convErr := strconv.Atoi(id) + if convErr != nil { rel := strings.TrimPrefix(path, dataDir+"/") issues = append(issues, Issue{ Level: "ERROR", Type: "integrity", Message: fmt.Sprintf("room %s: filename is not a numeric room ID and the file is ignored", rel), }) + } else if n <= 0 { + rel := strings.TrimPrefix(path, dataDir+"/") + issues = append(issues, Issue{ + Level: "ERROR", + Type: "integrity", + Message: fmt.Sprintf("room %s: room ID must be positive, got %d", rel, n), + }) } return nil }); err != nil { |
