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 modify addPlayer
join $ gets $ view $ progMode.createPlayerStateL.cpsSuccessCallback join $ gets $ view $ progMode.createPlayerStateL.cpsSuccessCallback
Just False -> Just False ->
ifM (gets $ view $ progMode.createPlayerStateL.cpsAbortable) join $ gets $ view $ progMode.createPlayerStateL.cpsFailureCallback
(join $ gets $ view $ progMode.createPlayerStateL.cpsFailureCallback)
(modify $ progMode.createPlayerStateL
%~ (cpsNumber .~ Nothing)
. (cpsName .~ "")
. (cpsPosition .~ ""))
Nothing -> return () Nothing -> return ()
return True return True
} }

View File

@ -180,7 +180,6 @@ selectPlayerPrompt pStr callback = Prompt
mode <- gets $ view progMode mode <- gets $ view progMode
let let
cps = newCreatePlayerState cps = newCreatePlayerState
& cpsAbortable .~ False
& cpsName .~ sStr & cpsName .~ sStr
& cpsSuccessCallback .~ do & cpsSuccessCallback .~ do
modify $ progMode .~ mode modify $ progMode .~ mode
@ -188,7 +187,6 @@ selectPlayerPrompt pStr callback = Prompt
callback $ Just pIndex callback $ Just pIndex
& cpsFailureCallback .~ do & cpsFailureCallback .~ do
modify $ progMode .~ mode modify $ progMode .~ mode
callback Nothing
modify $ progMode .~ CreatePlayer cps modify $ progMode .~ CreatePlayer cps
, promptSpecialKey = \case , promptSpecialKey = \case
C.KeyFunction n -> do C.KeyFunction n -> do

View File

@ -64,7 +64,6 @@ module Mtlstats.Types (
selectedPlayer, selectedPlayer,
pMinsRecorded, pMinsRecorded,
-- ** CreatePlayerState Lenses -- ** CreatePlayerState Lenses
cpsAbortable,
cpsNumber, cpsNumber,
cpsName, cpsName,
cpsPosition, cpsPosition,
@ -244,9 +243,7 @@ data GameType
-- | Player creation status -- | Player creation status
data CreatePlayerState = CreatePlayerState data CreatePlayerState = CreatePlayerState
{ _cpsAbortable :: Bool { _cpsNumber :: Maybe Int
-- ^ Set to 'True' when player creation is abortable
, _cpsNumber :: Maybe Int
-- ^ The player's number -- ^ The player's number
, _cpsName :: String , _cpsName :: String
-- ^ The player's name -- ^ The player's name
@ -544,8 +541,7 @@ newGameState = GameState
-- | Constructor for a 'CreatePlayerState' -- | Constructor for a 'CreatePlayerState'
newCreatePlayerState :: CreatePlayerState newCreatePlayerState :: CreatePlayerState
newCreatePlayerState = CreatePlayerState newCreatePlayerState = CreatePlayerState
{ _cpsAbortable = True { _cpsNumber = Nothing
, _cpsNumber = Nothing
, _cpsName = "" , _cpsName = ""
, _cpsPosition = "" , _cpsPosition = ""
, _cpsSuccessCallback = return () , _cpsSuccessCallback = return ()