From 4a113d06e1833701d5fb682ad6b5e09bb2813eec Mon Sep 17 00:00:00 2001 From: Jonathan Lamothe Date: Wed, 30 Oct 2019 00:45:16 -0400 Subject: [PATCH] bugfix: don't abort player selection ...upon cancellation of player creation --- src/Mtlstats/Control.hs | 7 +------ src/Mtlstats/Prompt.hs | 2 -- src/Mtlstats/Types.hs | 8 ++------ 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/src/Mtlstats/Control.hs b/src/Mtlstats/Control.hs index 6ef2aec..3f7fba2 100644 --- a/src/Mtlstats/Control.hs +++ b/src/Mtlstats/Control.hs @@ -331,12 +331,7 @@ confirmCreatePlayerC = Controller modify addPlayer join $ gets $ view $ progMode.createPlayerStateL.cpsSuccessCallback Just False -> - ifM (gets $ view $ progMode.createPlayerStateL.cpsAbortable) - (join $ gets $ view $ progMode.createPlayerStateL.cpsFailureCallback) - (modify $ progMode.createPlayerStateL - %~ (cpsNumber .~ Nothing) - . (cpsName .~ "") - . (cpsPosition .~ "")) + join $ gets $ view $ progMode.createPlayerStateL.cpsFailureCallback Nothing -> return () return True } diff --git a/src/Mtlstats/Prompt.hs b/src/Mtlstats/Prompt.hs index 7c529d4..16570ae 100644 --- a/src/Mtlstats/Prompt.hs +++ b/src/Mtlstats/Prompt.hs @@ -180,7 +180,6 @@ selectPlayerPrompt pStr callback = Prompt mode <- gets $ view progMode let cps = newCreatePlayerState - & cpsAbortable .~ False & cpsName .~ sStr & cpsSuccessCallback .~ do modify $ progMode .~ mode @@ -188,7 +187,6 @@ selectPlayerPrompt pStr callback = Prompt callback $ Just pIndex & cpsFailureCallback .~ do modify $ progMode .~ mode - callback Nothing modify $ progMode .~ CreatePlayer cps , promptSpecialKey = \case C.KeyFunction n -> do diff --git a/src/Mtlstats/Types.hs b/src/Mtlstats/Types.hs index 8ac5f77..7d13fc5 100644 --- a/src/Mtlstats/Types.hs +++ b/src/Mtlstats/Types.hs @@ -64,7 +64,6 @@ module Mtlstats.Types ( selectedPlayer, pMinsRecorded, -- ** CreatePlayerState Lenses - cpsAbortable, cpsNumber, cpsName, cpsPosition, @@ -244,9 +243,7 @@ data GameType -- | Player creation status data CreatePlayerState = CreatePlayerState - { _cpsAbortable :: Bool - -- ^ Set to 'True' when player creation is abortable - , _cpsNumber :: Maybe Int + { _cpsNumber :: Maybe Int -- ^ The player's number , _cpsName :: String -- ^ The player's name @@ -544,8 +541,7 @@ newGameState = GameState -- | Constructor for a 'CreatePlayerState' newCreatePlayerState :: CreatePlayerState newCreatePlayerState = CreatePlayerState - { _cpsAbortable = True - , _cpsNumber = Nothing + { _cpsNumber = Nothing , _cpsName = "" , _cpsPosition = "" , _cpsSuccessCallback = return ()