Merge pull request #28 from mtlstats/bugfix-selection-abort
bugfix: don't abort player selection
This commit is contained in:
commit
5677263750
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 ()
|
||||
|
|
Loading…
Reference in New Issue
Block a user