diff options
| author | historia <[not public]> | 2026-06-29 18:13:33 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-06-29 18:13:33 -0400 |
| commit | 7d76673fa0707d204c7d084c8f90c8133c22a31a (patch) | |
| tree | 6fc832b9f3fde6ed455abb535f6e28b0e5db1fd9 /internal/game/core_validate.go | |
| parent | feb80b7dde200d4121cd9f9c583a08f9869c5588 (diff) | |
| download | thehouseoficarus-7d76673fa0707d204c7d084c8f90c8133c22a31a.tar.gz | |
feat: migrated map (and bfs) to full 3D instead of individual 2D maps on different planes.
Diffstat (limited to 'internal/game/core_validate.go')
| -rw-r--r-- | internal/game/core_validate.go | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/internal/game/core_validate.go b/internal/game/core_validate.go new file mode 100644 index 0000000..4a2e5b9 --- /dev/null +++ b/internal/game/core_validate.go @@ -0,0 +1,53 @@ +package game + +import ( + "thehouseoficarus/internal/validate" +) + +// ValidateAndLog runs all startup integrity checks and logs the results. +func (g *Game) ValidateAndLog() { + validate.LogIssues(validate.Run(g.validationSource())) +} + +// validationSource assembles the read-only view of all data stores that the +// validate package needs, including the game-defined tech and course tables. +func (g *Game) validationSource() validate.Source { + courses := g.CourseStore.AllCourses() + courseViews := make([]validate.CourseView, 0, len(courses)) + for id, cfg := range courses { + rooms := make([]int, 0, len(cfg.Obstacles)) + for _, obs := range cfg.Obstacles { + rooms = append(rooms, obs.RoomID) + } + courseViews = append(courseViews, validate.CourseView{ + ID: id, + StartRoom: cfg.StartRoom, + ObstacleRooms: rooms, + }) + } + + techViews := make([]validate.TechView, 0, len(AllTechs)) + techIDs := make(map[string]bool, len(AllTechs)) + for _, t := range AllTechs { + techViews = append(techViews, validate.TechView{ + ID: t.ID, + Name: t.Name, + Category: t.Category, + DrainRate: t.DrainRate, + }) + techIDs[t.ID] = true + } + + return validate.Source{ + DataDir: g.DataDir, + Items: g.ItemStore, + Objects: g.ObjectStore, + Mobs: g.MobStore, + World: g.World, + Courses: courseViews, + Techs: techViews, + TechIDs: techIDs, + RootRooms: g.ValidationConfig.RootRooms, + IgnoreUnreachable: g.ValidationConfig.IgnoreUnreachable, + } +} |
