1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

Fixed music playback on switching between towns

This commit is contained in:
Ivan Savenko 2023-04-28 16:53:45 +03:00
parent 9296306fa3
commit 76d5b459f1

View File

@ -1206,13 +1206,17 @@ CCastleInterface::CCastleInterface(const CGTownInstance * Town, const CGTownInst
townlist->onSelect = std::bind(&CCastleInterface::townChange, this);
recreateIcons();
adventureInt->onAudioPaused();
if (!from)
adventureInt->onAudioPaused();
CCS->musich->playMusic(town->town->clientInfo.musicTheme, true, false);
}
CCastleInterface::~CCastleInterface()
{
if (adventureInt) // may happen on exiting client with open castle interface
// resume map audio if:
// adventureInt exists (may happen on exiting client with open castle interface)
// castleInt has not been replaced (happens on switching between towns inside castle interface)
if (adventureInt && LOCPLINT->castleInt == this)
adventureInt->onAudioResumed();
if(LOCPLINT->castleInt == this)
LOCPLINT->castleInt = nullptr;