From 38c0cd138be15ada982a47f48259bb4292a3d0b9 Mon Sep 17 00:00:00 2001 From: Laserlicht <13953785+Laserlicht@users.noreply.github.com> Date: Sat, 21 Dec 2024 01:38:29 +0100 Subject: [PATCH] fix music --- client/mainmenu/CHighScoreScreen.cpp | 12 +++++++++--- client/mainmenu/CHighScoreScreen.h | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/client/mainmenu/CHighScoreScreen.cpp b/client/mainmenu/CHighScoreScreen.cpp index ab985497a..ab0ae6b4e 100644 --- a/client/mainmenu/CHighScoreScreen.cpp +++ b/client/mainmenu/CHighScoreScreen.cpp @@ -216,9 +216,15 @@ CHighScoreInputScreen::CHighScoreInputScreen(bool won, HighScoreCalculation calc } } +void CHighScoreInputScreen::stopMusicAndClose() +{ + CMM->playMusic(); + close(); +} + void CHighScoreInputScreen::onVideoPlaybackFinished() { - close(); + stopMusicAndClose(); } int CHighScoreInputScreen::addEntry(std::string text) { @@ -275,7 +281,7 @@ void CHighScoreInputScreen::clickPressed(const Point & cursorPosition) if(!won) { - close(); + stopMusicAndClose(); return; } @@ -291,7 +297,7 @@ void CHighScoreInputScreen::clickPressed(const Point & cursorPosition) GH.windows().createAndPushWindow(calc.isCampaign ? CHighScoreScreen::HighScorePage::CAMPAIGN : CHighScoreScreen::HighScorePage::SCENARIO, pos); } else - close(); + stopMusicAndClose(); }); } } diff --git a/client/mainmenu/CHighScoreScreen.h b/client/mainmenu/CHighScoreScreen.h index e0c3b5c69..a8d68011e 100644 --- a/client/mainmenu/CHighScoreScreen.h +++ b/client/mainmenu/CHighScoreScreen.h @@ -85,6 +85,7 @@ class CHighScoreInputScreen : public CWindowObject, public IVideoHolder HighScoreCalculation calc; StatisticDataSet stat; + void stopMusicAndClose(); void onVideoPlaybackFinished() override; public: CHighScoreInputScreen(bool won, HighScoreCalculation calc, const StatisticDataSet & statistic);