Browse Source

fix music

Laserlicht 11 months ago
parent
commit
38c0cd138b
2 changed files with 10 additions and 3 deletions
  1. 9 3
      client/mainmenu/CHighScoreScreen.cpp
  2. 1 0
      client/mainmenu/CHighScoreScreen.h

+ 9 - 3
client/mainmenu/CHighScoreScreen.cpp

@@ -216,11 +216,17 @@ CHighScoreInputScreen::CHighScoreInputScreen(bool won, HighScoreCalculation calc
 	}
 }
 
-void CHighScoreInputScreen::onVideoPlaybackFinished()
+void CHighScoreInputScreen::stopMusicAndClose()
 {
+	CMM->playMusic();
 	close();
 }
 
+void CHighScoreInputScreen::onVideoPlaybackFinished()
+{
+	stopMusicAndClose();
+}
+
 int CHighScoreInputScreen::addEntry(std::string text) {
 	std::vector<JsonNode> baseNode = persistentStorage["highscore"][calc.isCampaign ? "campaign" : "scenario"].Vector();
 	
@@ -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<CHighScoreScreen>(calc.isCampaign ? CHighScoreScreen::HighScorePage::CAMPAIGN : CHighScoreScreen::HighScorePage::SCENARIO, pos);
 			}
 			else
-				close();
+				stopMusicAndClose();
 		});
 	}
 }

+ 1 - 0
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);