Move towards serializing saves/loads faster
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user