Prettify saved config

This commit is contained in:
2022-04-11 08:47:30 +01:00
parent 3592245b46
commit ab2408b480
6 changed files with 14 additions and 6 deletions
+2
View File
@@ -21,6 +21,7 @@ data Configuration = Configuration
, _debug_seconds_frame :: Bool
, _debug_noclip :: Bool
, _debug_cr_status :: Bool
, _debug_cr_awareness :: Bool
, _debug_view_boundaries :: Bool
, _debug_view_clip_bounds :: RoomClipping
, _debug_pathing :: Bool
@@ -66,6 +67,7 @@ defaultConfig = Configuration
, _debug_seconds_frame = True
, _debug_noclip = False
, _debug_cr_status = False
, _debug_cr_awareness = False
, _debug_view_boundaries = False
, _debug_view_clip_bounds = NoRoomClipBoundaries
, _debug_pathing = False
+5 -2
View File
@@ -12,7 +12,9 @@ import Sound
import Data.Preload
import Preload.Update
import Data.Aeson (encodeFile)
--import Data.Aeson (encodeFile)
import Data.Aeson.Encode.Pretty (encodePretty)
import qualified Data.ByteString.Lazy as BS
--import Control.Monad (when)
{- |
Write the current world configuration to disk as a json file.
@@ -20,7 +22,8 @@ Write the current world configuration to disk as a json file.
saveConfig :: Configuration -> (a -> IO a) -> a -> IO a
saveConfig cfig f x = do
putStrLn "Saving config to data/dodge.config.json"
encodeFile "data/dodge.config.json" cfig
BS.writeFile "data/dodge.config.json" $ encodePretty cfig
-- encodeFile "data/dodge.config.json" cfig
f x
{- |
Apply the volume settings from the world configuration to the running game.