From a6cf03a6ae98e4fb675da25046d148e92bcf7206 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Wed, 16 Sep 2026 15:00:46 -0400 Subject: chore: staticcheck and gofmt cleanups --- internal/admin/api_room_courses.go | 56 -------------------------------------- 1 file changed, 56 deletions(-) (limited to 'internal/admin/api_room_courses.go') 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 { -- cgit v1.2.3