From e59ecbd1e1ec76dbf7154a1aae6d5af84daf8906 Mon Sep 17 00:00:00 2001 From: nek0 Date: Sun, 26 Feb 2017 02:14:49 +0100 Subject: [PATCH] fix state fuckup --- src/Commons.hs | 8 ++++++-- src/InGame.hs | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Commons.hs b/src/Commons.hs index b3ea430..71498cd 100644 --- a/src/Commons.hs +++ b/src/Commons.hs @@ -263,7 +263,8 @@ haskelloidShotDown h = do putAffection ud { wonlost = True } - putAffection ud + ud2 <- getAffection + putAffection ud2 { haskelloids = newHaskelloids } @@ -293,7 +294,10 @@ updateHaskelloid sec h@Haskelloid{..} = do 50 ) _ -> return Nothing - maybe (return ()) (const lose) lost + maybe (return ()) (const $ do + lose + putAffection ud {wonlost = True} + ) lost return h { hPos = (nnx, nny) , hRot = newRot diff --git a/src/InGame.hs b/src/InGame.hs index e711a97..750ea83 100644 --- a/src/InGame.hs +++ b/src/InGame.hs @@ -15,6 +15,7 @@ import Debug.Trace import Types import Commons +import Menu loadGame :: Affection UserData () loadGame = do @@ -103,7 +104,8 @@ updateGame sec = do } ud2 <- getAffection nhs <- mapM (updateHaskelloid sec) (haskelloids ud2) - putAffection ud2 + ud3 <- getAffection + putAffection ud3 { haskelloids = nhs } -- liftIO $ traceIO $ show $ length nhs