Stop music in Atlas when reloading a map, patch by trompetin17, fixes #1712.

This was SVN commit r16084.
This commit is contained in:
Itms
2014-12-29 21:01:54 +00:00
parent f337905f14
commit daaddaf433
3 changed files with 15 additions and 5 deletions
@@ -401,6 +401,7 @@ void MapSidebar::OnMapReload()
// Reset sim test buttons
POST_MESSAGE(SimPlay, (0.f, false));
POST_MESSAGE(SimStopMusic, ());
POST_MESSAGE(GuiSwitchPage, (L"page_atlas.xml"));
m_SimState = SimInactive;
UpdateSimButtons();
@@ -480,6 +481,7 @@ void MapSidebar::OnSimReset(wxCommandEvent& WXUNUSED(event))
{
POST_MESSAGE(SimPlay, (0.f, true));
POST_MESSAGE(SimStateRestore, (L"default"));
POST_MESSAGE(SimStopMusic, ());
POST_MESSAGE(SimPlay, (0.f, false));
POST_MESSAGE(GuiSwitchPage, (L"page_atlas.xml"));
m_SimState = SimInactive;
@@ -488,6 +490,7 @@ void MapSidebar::OnSimReset(wxCommandEvent& WXUNUSED(event))
{
POST_MESSAGE(SimPlay, (0.f, true));
POST_MESSAGE(SimStateRestore, (L"default"));
POST_MESSAGE(SimStopMusic, ());
POST_MESSAGE(SimPlay, (0.f, false));
POST_MESSAGE(GuiSwitchPage, (L"page_atlas.xml"));
m_SimState = SimInactive;
@@ -127,6 +127,15 @@ QUERYHANDLER(Ping)
{
UNUSED2(msg);
}
MESSAGEHANDLER(SimStopMusic)
{
UNUSED2(msg);
CmpPtr<ICmpSoundManager> cmpSoundManager(*g_Game->GetSimulation2(), SYSTEM_ENTITY);
if (cmpSoundManager)
cmpSoundManager->StopMusic();
}
MESSAGEHANDLER(SimStateSave)
{
@@ -135,10 +144,6 @@ MESSAGEHANDLER(SimStateSave)
MESSAGEHANDLER(SimStateRestore)
{
CmpPtr<ICmpSoundManager> cmpSoundManager(*g_Game->GetSimulation2(), SYSTEM_ENTITY);
if (cmpSoundManager)
cmpSoundManager->StopMusic();
AtlasView::GetView_Game()->RestoreState(*msg->label);
}
+3 -1
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2013 Wildfire Games.
/* Copyright (C) 2014 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -101,6 +101,8 @@ MESSAGE(GuiCharEvent,
//////////////////////////////////////////////////////////////////////////
MESSAGE(SimStopMusic, );
MESSAGE(SimStateSave,
((std::wstring, label)) // named slot to store saved data
);