about summary refs log tree commit diff
path: root/src/Main.hs
diff options
context:
space:
mode:
authorGriffin Smith <root@gws.fyi>2020-02-17T18·24-0500
committerGriffin Smith <root@gws.fyi>2020-02-17T18·24-0500
commit1265155ae43f59c6bbd4b25f2747515cdf416622 (patch)
treed69e2638c49383308bfdd8641f0562365ab71ed2 /src/Main.hs
parent69ccf3a77de7b11ea1c8c11d96ae14595b204589 (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.hs6
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