Merge pull request #28 from mtlstats/bugfix-selection-abort

bugfix: don't abort player selection
This commit is contained in:
Jonathan Lamothe 2019-10-30 00:53:50 -04:00 committed by GitHub
commit 5677263750
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 14 deletions

View File

@ -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
}

View File

@ -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

View File

@ -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 ()