From 76d5b459f162aed05915c18adf2ac148d93ec748 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Fri, 28 Apr 2023 16:53:45 +0300 Subject: [PATCH] Fixed music playback on switching between towns --- client/windows/CCastleInterface.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/client/windows/CCastleInterface.cpp b/client/windows/CCastleInterface.cpp index e37471223..16d28aaa6 100644 --- a/client/windows/CCastleInterface.cpp +++ b/client/windows/CCastleInterface.cpp @@ -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;