implemented player position editing

This commit is contained in:
Jonathan Lamothe 2019-11-01 06:26:38 -04:00
parent 5bf5a605aa
commit fc31794ef4
2 changed files with 12 additions and 1 deletions

View File

@ -87,7 +87,12 @@ nameC = Controller
}
positionC :: Controller
positionC = undefined
positionC = Controller
{ drawController = drawPrompt editPlayerPosPrompt
, handleController = \e -> do
promptHandler editPlayerPosPrompt e
return True
}
ytdGoalsC :: Controller
ytdGoalsC = undefined

View File

@ -22,6 +22,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
module Mtlstats.Prompt.EditPlayer
( editPlayerNumPrompt
, editPlayerNamePrompt
, editPlayerPosPrompt
) where
import Control.Monad.Extra (whenJustM)
@ -42,6 +43,11 @@ editPlayerNamePrompt :: Prompt
editPlayerNamePrompt = strPrompt "Player name: " $
editPlayer . (pName .~)
-- | Prompt to edit a player's position
editPlayerPosPrompt :: Prompt
editPlayerPosPrompt = strPrompt "Player position: " $
editPlayer . (pPosition .~)
editPlayer :: (Player -> Player) -> Action ()
editPlayer f =
whenJustM (gets (^.progMode.editPlayerStateL.epsSelectedPlayer)) $ \pid ->