aboutsummaryrefslogtreecommitdiff
path: root/internal/validate
diff options
context:
space:
mode:
Diffstat (limited to 'internal/validate')
-rw-r--r--internal/validate/checks.go33
1 files changed, 33 insertions, 0 deletions
diff --git a/internal/validate/checks.go b/internal/validate/checks.go
index ccf996c..974998a 100644
--- a/internal/validate/checks.go
+++ b/internal/validate/checks.go
@@ -1024,6 +1024,39 @@ func validateRoomGrid(s Source) []Issue {
}
}
+ onConf := func(origin int) func(c world.GridConflict) {
+ return func(c world.GridConflict) {
+ switch c.Kind {
+ case "twist":
+ issues = append(issues, Issue{
+ Level: "ERROR",
+ Type: "integrity",
+ Message: fmt.Sprintf(
+ "Grid twist: room %d (via %d %s) maps to (%d,%d,%d) but was already placed at (%d,%d,%d) [origin %d]",
+ c.Target, c.From, c.Dir, c.Want[0], c.Want[1], c.Want[2], c.Existing[0], c.Existing[1], c.Existing[2], origin),
+ })
+ case "overlap":
+ issues = append(issues, Issue{
+ Level: "ERROR",
+ Type: "integrity",
+ Message: fmt.Sprintf(
+ "Grid overlap: room %d (via %d %s) wants (%d,%d,%d), already used by room %d [origin %d]",
+ c.Target, c.From, c.Dir, c.Want[0], c.Want[1], c.Want[2], c.Occupier, origin),
+ })
+ }
+ }
+ }
+
+ for id := range roomIndex {
+ if placed[id] {
+ continue
+ }
+ grid := world.BuildGrid(id, load, include, onConf(id))
+ for rid := range grid.Coord {
+ placed[rid] = true
+ }
+ }
+
return issues
}