Skip to content

Commit

Permalink
Merge branch 'main' into feature/skip-menu
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Jan 9, 2025
2 parents 77f6d9c + 54531b8 commit 1496281
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/swarm-tui/Swarm/TUI/Model/Dialog/Popup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ data Popup
= AchievementPopup CategorizedAchievement
| RecipesPopup
| CommandsPopup [Const]
| DebugWarningPopup

-- | State to track pending popup queue as well as any
-- popup which is currently being displayed.
Expand Down
8 changes: 7 additions & 1 deletion src/swarm-tui/Swarm/TUI/Model/StateUpdate.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import Control.Effect.Accum
import Control.Effect.Lift
import Control.Effect.Throw
import Control.Lens hiding (from, (<.>))
import Control.Monad (guard, void)
import Control.Monad (guard, unless, void)
import Control.Monad.Except (ExceptT (..))
import Control.Monad.IO.Class (MonadIO (liftIO))
import Control.Monad.State (MonadState, execStateT)
Expand Down Expand Up @@ -217,6 +217,12 @@ startGameWithSeed siPair@(_scene, si) lp = do
-- Beware: currentScenarioPath must be set so that progress/achievements can be saved.
-- It has just been cleared in scenarioToAppState.
gameState . currentScenarioPath .= Just p

-- Warn the user that the use of debugging options means progress
-- will not be saved.
debugging <- use $ uiState . uiDebugOptions
unless (null debugging) $
uiState . uiPopups %= addPopup DebugWarningPopup
where
prevBest t = case si ^. scenarioStatus of
NotStarted -> emptyBest t
Expand Down
5 changes: 5 additions & 0 deletions src/swarm-tui/Swarm/TUI/View/Popup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ drawPopup s = \case
]
, txt $ "Hit " <> bindingText s (SE.Main SE.ViewCommandsEvent) <> " to view all available commands."
]
DebugWarningPopup ->
hBox
[ withAttr notifAttr (txt "Warning: ")
, txt "No progress will be saved, since debugging flags are in use."
]

-- | Compute the number of rows of the notification popup we should be
-- showing, based on the number of frames the popup has existed.
Expand Down

0 comments on commit 1496281

Please sign in to comment.