feat(gs/xanthous): Default to the current save file

When saving, default to the save file that was loaded for the game if
any. To support this, this also makes text prompts support a default,
which will be used if no value is input.

Change-Id: I72a826499d6e987b939e3465a2d29167e53416be
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3801
Reviewed-by: grfn <grfn@gws.fyi>
Tested-by: BuildkiteCI
This commit is contained in:
Griffin Smith 2021-11-06 11:44:14 -04:00 committed by grfn
parent 099f36e5ee
commit ff6c008d78
8 changed files with 93 additions and 31 deletions

View file

@ -43,8 +43,12 @@ drawPromptState :: GamePromptState m -> Widget ResourceName
drawPromptState NoPrompt = emptyWidget
drawPromptState (WaitingPrompt msg (Prompt _ pt ps pri _)) =
case (pt, ps, pri) of
(SStringPrompt, StringPromptState edit, _) ->
txtWrap msg <+> txt " " <+> renderEditor (txt . fold) True edit
(SStringPrompt, StringPromptState edit, mDef) ->
txtWrap msg
<+> txt " "
<+> txt (maybe "" (\def -> "(default: " <> def <> ")") mDef)
<+> txt " "
<+> renderEditor (txt . fold) True edit
(SDirectionPrompt, DirectionPromptState, _) -> txtWrap msg
(SMenu, _, menuItems) ->
txtWrap msg