Skip to content

Add onPause() and onUnpause() - fix music resuming after saving when paused#3185

Open
LeeSpork wants to merge 12 commits intoOpenLoco:masterfrom
LeeSpork:smarter-pausing
Open

Add onPause() and onUnpause() - fix music resuming after saving when paused#3185
LeeSpork wants to merge 12 commits intoOpenLoco:masterfrom
LeeSpork:smarter-pausing

Conversation

@LeeSpork
Copy link
Copy Markdown
Contributor

@LeeSpork LeeSpork commented Aug 6, 2025

Deduplicates code and fixes #3183 by adding onPause() and onUnpause() to SceneManager.cpp (let me know if there is a better place to put them), which are only called when the game is actually fully unpaused, or paused from being fully unpaused.

@LeeSpork
Copy link
Copy Markdown
Contributor Author

LeeSpork commented Aug 7, 2025

This will be made redundant if #3187 is merged.

@LeeSpork LeeSpork closed this Aug 7, 2025
@LeeSpork LeeSpork reopened this Aug 7, 2025
static void onPause()
{
Audio::pauseSound();
Ui::Windows::TimePanel::invalidateFrame();
Copy link
Copy Markdown
Contributor Author

@LeeSpork LeeSpork Aug 9, 2025

Choose a reason for hiding this comment

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

GameCommands.cpp and PromptSaveWindow.cpp used
WindowManager::invalidate(WindowType::timeToolbar);

while TogglePause.cpp used
Ui::Windows::TimePanel::invalidateFrame();

Those appear to be two different ways of achieving the same result. I went with the latter because it did not require adding an additional include to this file.

@LeeSpork LeeSpork changed the title Add onPause() and onUnpause() Add onPause() and onUnpause() - fix music resuming after saving when paused Aug 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Saving game while in pause restarts music but not the game

2 participants