From abd612c15799f604e671e83dc7c410ed2b44185f Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Thu, 25 Jun 2026 15:40:48 -0400 Subject: slop refactor --- internal/game/core_course.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'internal/game/core_course.go') diff --git a/internal/game/core_course.go b/internal/game/core_course.go index 7d7fe08..2b6b28f 100644 --- a/internal/game/core_course.go +++ b/internal/game/core_course.go @@ -4,8 +4,8 @@ import ( "path/filepath" "sync" - "thehouseoficarus/internal/action" "gopkg.in/yaml.v3" + "thehouseoficarus/internal/behavior" ) type ObstacleDef struct { @@ -77,6 +77,16 @@ func (cs *CourseStore) LoadAll() { cs.loadAllLocked() } +// AllCourses returns the full course config map, loading on first access. +func (cs *CourseStore) AllCourses() map[string]*CourseConfig { + cs.mu.Lock() + defer cs.mu.Unlock() + if !cs.loaded { + cs.loadAllLocked() + } + return cs.courses +} + func (cs *CourseStore) GetObstacle(roomID int) *ObstacleInfo { cs.mu.Lock() defer cs.mu.Unlock() @@ -91,7 +101,7 @@ func (cs *CourseStore) loadAllLocked() { cs.roomToObstacle = make(map[int]*ObstacleInfo) localVerbs := make(map[string]bool) - action.WalkYAMLDir(filepath.Join(cs.dataDir, "courses"), func(path, id string, data []byte) error { + behavior.WalkYAMLDir(filepath.Join(cs.dataDir, "courses"), func(path, id string, data []byte) error { var cfg CourseConfig if err := yaml.Unmarshal(data, &cfg); err != nil { return nil -- cgit v1.2.3