diff options
author | Griffin Smith <root@gws.fyi> | 2020-02-17T18·24-0500 |
---|---|---|
committer | Griffin Smith <root@gws.fyi> | 2020-02-17T18·24-0500 |
commit | 1265155ae43f59c6bbd4b25f2747515cdf416622 (patch) | |
tree | d69e2638c49383308bfdd8641f0562365ab71ed2 /src/Main.hs | |
parent | 69ccf3a77de7b11ea1c8c11d96ae14595b204589 (diff) |
Don't run initEvent when loading the game
Rather than having a single sentWelcome boolean, avoid running the initEvent entirely when loading an already-initialized game. Among other things, this stops us from re-generating a level and then merging it with the existing one when the game is loaded (oops).
Diffstat (limited to 'src/Main.hs')
-rw-r--r-- | src/Main.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Main.hs b/src/Main.hs index b11f1b9f4960..95cfc9edbaff 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -9,7 +9,7 @@ import Control.Exception (finally) import System.Exit (die) -------------------------------------------------------------------------------- import qualified Xanthous.Game as Game -import Xanthous.App (makeApp) +import Xanthous.App import Xanthous.Generators ( GeneratorInput , parseGeneratorInput @@ -94,7 +94,7 @@ thanks = putStr "\n\n" >> putStrLn "Thanks for playing Xanthous!" runGame :: RunParams -> IO () runGame rparams = do - app <- makeApp + app <- makeApp NewGame gameSeed <- maybe getRandom pure $ seed rparams when (isNothing $ seed rparams) . putStrLn @@ -113,7 +113,7 @@ runGame rparams = do loadGame :: FilePath -> IO () loadGame saveFile = do - app <- makeApp + app <- makeApp LoadGame gameState <- maybe (die "Invalid save file!") pure =<< Game.loadGame . fromStrict <$> readFile @IO saveFile _game' <- gameState `deepseq` defaultMain app gameState `finally` thanks |