aboutsummaryrefslogtreecommitdiff
path: root/internal/game/core_course.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-06-25 15:40:48 -0400
committerhistoria <[not public]>2026-06-25 15:40:48 -0400
commitabd612c15799f604e671e83dc7c410ed2b44185f (patch)
tree0597ca92350de73aac2a7cf26b2f2d6595dac0cc /internal/game/core_course.go
parent2725e2927a1595c7b100d942d1f14146252adeb7 (diff)
downloadthehouseoficarus-abd612c15799f604e671e83dc7c410ed2b44185f.tar.gz
slop refactor
Diffstat (limited to 'internal/game/core_course.go')
-rw-r--r--internal/game/core_course.go14
1 files changed, 12 insertions, 2 deletions
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