Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset lastFrameTime when starting a new scenario #855

Merged
merged 2 commits into from
Nov 13, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/Swarm/TUI/Model.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1039,7 +1039,8 @@ scenarioToAppState siPair@(scene, _) userSeed toRun = do

-- | Modify the UI state appropriately when starting a new scenario.
scenarioToUIState :: ScenarioInfoPair -> UIState -> IO UIState
scenarioToUIState siPair u =
scenarioToUIState siPair u = do
curTime <- getTime Monotonic
return $
u
& uiPlaying .~ True
Expand All @@ -1053,3 +1054,4 @@ scenarioToUIState siPair u =
& uiREPL .~ initREPLState (u ^. uiREPL . replHistory)
& uiREPL . replHistory %~ restartREPLHistory
& scenarioRef ?~ siPair
& lastFrameTime .~ curTime
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes me think we should have something like a UIGameState that is reset on a new game. 🤔

It should not be possible to carry over things between games both in GameState and in UIState.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or perhaps it means lastFrameTime really ought to live in GameState (once we fix #516 and #689).