Move from store to flat
This commit is contained in:
+5
-5
@@ -10,7 +10,7 @@ module Dodge.Save (
|
||||
fromJSONSaveSlot,
|
||||
) where
|
||||
|
||||
import qualified Data.Store as Store
|
||||
import Flat
|
||||
import Dodge.Concurrent
|
||||
import Control.Lens
|
||||
import Dodge.Data.SaveSlot
|
||||
@@ -27,7 +27,7 @@ writeSaveSlot ss u = do
|
||||
putStrLn $ "Saving " ++ saveSlotPath ss
|
||||
createDirectoryIfMissing True "saveSlot"
|
||||
BSS.writeFile (saveSlotPath ss) $
|
||||
Store.encode
|
||||
flat
|
||||
(u ^. uvWorld . cWorld)
|
||||
return Just
|
||||
|
||||
@@ -37,10 +37,10 @@ readSaveSlot ss = do
|
||||
if fExists
|
||||
then do
|
||||
bsstr <- BSS.readFile $ saveSlotPath ss
|
||||
cwstr <- Store.decodeIO $ bsstr
|
||||
let cwstr = unflat bsstr
|
||||
case cwstr of
|
||||
Nothing -> putStrLn "loadSaveSlot failed to read saved file" >> return removescreenlayers
|
||||
Just cw -> return $ \uv -> Just $ uv & uvWorld . cWorld .~ cw
|
||||
Left _ -> putStrLn "loadSaveSlot failed to read saved file" >> return removescreenlayers
|
||||
Right cw -> return $ \uv -> Just $ uv & uvWorld . cWorld .~ cw
|
||||
& uvScreenLayers .~ []
|
||||
else putStrLn "loadSaveSlot failed to find saved file" >> return removescreenlayers
|
||||
where
|
||||
|
||||
Reference in New Issue
Block a user