fix state fuckup

This commit is contained in:
nek0 2017-02-26 02:14:49 +01:00
parent 79642ec557
commit e59ecbd1e1
2 changed files with 9 additions and 3 deletions

View file

@ -263,7 +263,8 @@ haskelloidShotDown h = do
putAffection ud putAffection ud
{ wonlost = True { wonlost = True
} }
putAffection ud ud2 <- getAffection
putAffection ud2
{ haskelloids = newHaskelloids { haskelloids = newHaskelloids
} }
@ -293,7 +294,10 @@ updateHaskelloid sec h@Haskelloid{..} = do
50 50
) )
_ -> return Nothing _ -> return Nothing
maybe (return ()) (const lose) lost maybe (return ()) (const $ do
lose
putAffection ud {wonlost = True}
) lost
return h return h
{ hPos = (nnx, nny) { hPos = (nnx, nny)
, hRot = newRot , hRot = newRot

View file

@ -15,6 +15,7 @@ import Debug.Trace
import Types import Types
import Commons import Commons
import Menu
loadGame :: Affection UserData () loadGame :: Affection UserData ()
loadGame = do loadGame = do
@ -103,7 +104,8 @@ updateGame sec = do
} }
ud2 <- getAffection ud2 <- getAffection
nhs <- mapM (updateHaskelloid sec) (haskelloids ud2) nhs <- mapM (updateHaskelloid sec) (haskelloids ud2)
putAffection ud2 ud3 <- getAffection
putAffection ud3
{ haskelloids = nhs { haskelloids = nhs
} }
-- liftIO $ traceIO $ show $ length nhs -- liftIO $ traceIO $ show $ length nhs