aboutsummaryrefslogtreecommitdiff
path: root/internal/admin/api_room_courses.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-16 15:00:46 -0400
committerhistoria <[not public]>2026-09-16 15:00:46 -0400
commita6cf03a6ae98e4fb675da25046d148e92bcf7206 (patch)
tree194499fe9e696be8c31cd915b7ad92678f9f95e0 /internal/admin/api_room_courses.go
parent9192d94dea6be5498ab080f3e2df5667af871d7a (diff)
downloadthehouseoficarus-a6cf03a6ae98e4fb675da25046d148e92bcf7206.tar.gz
chore: staticcheck and gofmt cleanups
Diffstat (limited to 'internal/admin/api_room_courses.go')
-rw-r--r--internal/admin/api_room_courses.go56
1 files changed, 0 insertions, 56 deletions
diff --git a/internal/admin/api_room_courses.go b/internal/admin/api_room_courses.go
index 47e4d8c..b8f334e 100644
--- a/internal/admin/api_room_courses.go
+++ b/internal/admin/api_room_courses.go
@@ -105,19 +105,6 @@ func toInt(v any) int {
return 0
}
-// toFloat64 coerces yaml-decoded numbers to float64.
-func toFloat64(v any) float64 {
- switch x := v.(type) {
- case int:
- return float64(x)
- case int64:
- return float64(x)
- case float64:
- return x
- }
- return 0
-}
-
// indexOfObstacleForRoom returns the index of the obstacle whose room_id
// matches roomID, or -1 if none.
func indexOfObstacleForRoom(obstacles []map[string]any, roomID int) int {
@@ -515,39 +502,6 @@ func (s *AdminServer) loadRoomMapByID(roomID int) (map[string]any, []byte, strin
return m, data, path, nil
}
-// saveRoomMapByID writes a room map back to disk and pushes an undo entry.
-func (s *AdminServer) saveRoomMapByID(roomID int, m map[string]any, desc string) error {
- path, ok := s.world.GetRoomPath(roomID)
- if !ok {
- return fmt.Errorf("room %d not found", roomID)
- }
- oldContent, _ := snapshotFile(path)
- newContent, err := writeMapAsYAML(path, m)
- if err != nil {
- return err
- }
- s.undoStack.Push(ChangeDesc{
- Description: desc,
- FilePath: path,
- OldContent: oldContent,
- NewContent: newContent,
- })
- return nil
-}
-
-// removeExit deletes an exit by direction. Returns true if it existed.
-func removeExit(m map[string]any, dir string) bool {
- ex, ok := m["exits"].(map[string]any)
- if !ok {
- return false
- }
- if _, exists := ex[dir]; exists {
- delete(ex, dir)
- return true
- }
- return false
-}
-
// exitTargetRoom returns the target room ID of an exit value (scalar or map).
func exitTargetRoom(v any) int {
switch x := v.(type) {
@@ -563,16 +517,6 @@ func exitTargetRoom(v any) int {
return 0
}
-// exitIsAlwaysBlocked returns whether an exit value carries always_blocked: true.
-func exitIsAlwaysBlocked(v any) bool {
- if mm, ok := v.(map[string]any); ok {
- if h, ok := mm["always_blocked"]; ok {
- return h == true
- }
- }
- return false
-}
-
// isHorizontalDir returns whether d is one of the 8 horizontal directions.
func isHorizontalDir(d string) bool {
for _, h := range horizontalExitDirs {