Refactor, try to limit dependencies
This commit is contained in:
+11
-39
@@ -1,4 +1,3 @@
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE StrictData #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
@@ -6,8 +5,8 @@ module Dodge.Data.Config where
|
||||
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import qualified Data.Set as S
|
||||
import GHC.Generics
|
||||
|
||||
{-# ANN module "HLint: ignore Use camelCase" #-}
|
||||
|
||||
@@ -27,7 +26,7 @@ data Configuration = Configuration
|
||||
, _debug_view_clip_bounds :: RoomClipping
|
||||
, _debug_booleans :: S.Set DebugBool -- consider using Data.BitSet
|
||||
}
|
||||
deriving (Generic, Show)
|
||||
deriving (Show)
|
||||
|
||||
data DebugBool
|
||||
= Show_ms_frame
|
||||
@@ -52,23 +51,13 @@ data DebugBool
|
||||
| Inspect_wall
|
||||
| Show_nodes_near_select
|
||||
| Show_path_between
|
||||
deriving (Generic, Eq, Ord, Bounded, Enum, Show)
|
||||
deriving (Eq, Ord, Bounded, Enum, Show)
|
||||
|
||||
data ResFactor = FullRes | HalfRes | QuarterRes
|
||||
deriving (Generic, Show, Eq, Ord, Enum, Bounded)
|
||||
|
||||
instance ToJSON ResFactor where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
|
||||
instance FromJSON ResFactor
|
||||
deriving (Show, Eq, Ord, Enum, Bounded)
|
||||
|
||||
data RoomClipping = NoRoomClipBoundaries | AllRoomClipBoundaries | IntersectingRoomClipBoundaries
|
||||
deriving (Generic, Show, Eq, Ord, Enum, Bounded)
|
||||
|
||||
instance ToJSON RoomClipping where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
|
||||
instance FromJSON RoomClipping
|
||||
deriving (Show, Eq, Ord, Enum, Bounded)
|
||||
|
||||
resFactorNum :: ResFactor -> Int
|
||||
resFactorNum rf = case rf of
|
||||
@@ -76,18 +65,6 @@ resFactorNum rf = case rf of
|
||||
HalfRes -> 2
|
||||
QuarterRes -> 4
|
||||
|
||||
makeLenses ''Configuration
|
||||
|
||||
instance ToJSON DebugBool where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
|
||||
instance FromJSON DebugBool
|
||||
|
||||
instance ToJSON Configuration where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
|
||||
instance FromJSON Configuration
|
||||
|
||||
defaultConfig :: Configuration
|
||||
defaultConfig =
|
||||
Configuration
|
||||
@@ -105,18 +82,13 @@ defaultConfig =
|
||||
, _gameplay_rotate_to_wall = True
|
||||
, _debug_booleans = S.singleton Show_ms_frame
|
||||
, _debug_view_clip_bounds = NoRoomClipBoundaries
|
||||
-- , _debug_show_sound = False
|
||||
-- , _debug_seconds_frame = True
|
||||
-- , _debug_noclip = False
|
||||
-- , _debug_mouse_position = False
|
||||
-- , _debug_cr_status = False
|
||||
-- , _debug_cr_awareness = False
|
||||
-- , _debug_view_boundaries = False
|
||||
-- , _debug_pathing = False
|
||||
-- , _debug_walls = False
|
||||
-- , _debug_remove_LOS = False
|
||||
-- , _debug_cull_more_lights = False
|
||||
}
|
||||
|
||||
debugOn :: DebugBool -> Configuration -> Bool
|
||||
debugOn db = S.member db . _debug_booleans
|
||||
|
||||
makeLenses ''Configuration
|
||||
deriveJSON defaultOptions ''ResFactor
|
||||
deriveJSON defaultOptions ''RoomClipping
|
||||
deriveJSON defaultOptions ''DebugBool
|
||||
deriveJSON defaultOptions ''Configuration
|
||||
|
||||
Reference in New Issue
Block a user