Move towards serializing saves/loads faster

This commit is contained in:
2022-08-19 11:12:43 +01:00
parent c74d3b04bf
commit 9df0fa8692
38 changed files with 542 additions and 384 deletions
+16
View File
@@ -0,0 +1,16 @@
module Dodge.LoadSeed
where
import System.Directory
import Text.Read
loadSeed :: IO (Maybe Int)
loadSeed = maybeReadFile "saveSlot/seed" >>= (return . (>>= readMaybe))
maybeReadFile :: String -> IO (Maybe String)
maybeReadFile fpath = do
fexists <- doesFileExist fpath
if fexists
then do
str <- readFile fpath
return (Just str)
else return Nothing