Stop sound when patching sound bnp

develop
kaetemi 3 years ago committed by Nimetu
parent 3076b62063
commit 6d60cfee71

@ -1456,6 +1456,15 @@ void prelogInit()
} }
} }
void stopSoundMngr()
{
if (SoundMngr)
{
delete SoundMngr;
SoundMngr = NULL;
}
}
// *************************************************************************** // ***************************************************************************
void initBotObjectSelection() void initBotObjectSelection()
@ -1588,6 +1597,40 @@ void postlogInit()
// set the primitive context // set the primitive context
CPrimitiveContext::instance().CurrentLigoConfig = &LigoConfig; CPrimitiveContext::instance().CurrentLigoConfig = &LigoConfig;
{
H_AUTO(InitRZSound)
if (!SoundMngr)
{
// Init the sound manager
nmsg = "Initializing sound manager...";
ProgressBar.newMessage(ClientCfg.buildLoadingString(nmsg));
if (ClientCfg.SoundOn)
{
SoundMngr = new CSoundManager(&ProgressBar);
try
{
SoundMngr->init(&ProgressBar);
}
catch (const Exception &e)
{
nlwarning("init : Error when creating 'SoundMngr' : %s", e.what());
delete SoundMngr;
SoundMngr = NULL;
}
if (SoundMngr)
{
// init the SoundMngr with backuped volume
SoundMngr->setSFXVolume(ClientCfg.SoundSFXVolume);
SoundMngr->setGameMusicVolume(ClientCfg.SoundGameMusicVolume);
}
}
CPath::memoryCompress(); // Because sound calls addSearchPath
}
}
{ {
H_AUTO(InitRZShIdI) H_AUTO(InitRZShIdI)

@ -2592,7 +2592,7 @@ public:
} }
}; };
void stopSoundMngr();
// **************************************************************************** // ****************************************************************************
void CPatchThread::processFile (CPatchManager::SFileToPatch &rFTP) void CPatchThread::processFile (CPatchManager::SFileToPatch &rFTP)
@ -2605,6 +2605,12 @@ void CPatchThread::processFile (CPatchManager::SFileToPatch &rFTP)
// Destination File Name (in writable directory) // Destination File Name (in writable directory)
string DestinationName; string DestinationName;
if (NLMISC::startsWith(rFTP.FileName, "sound"))
{
// Stop sound playback
stopSoundMngr();
}
if (rFTP.ExtractPath.empty()) if (rFTP.ExtractPath.empty())
{ {
DestinationName = pPM->WritableClientDataPath + rFTP.FileName; DestinationName = pPM->WritableClientDataPath + rFTP.FileName;

@ -37,6 +37,10 @@ void quitCrashReport()
{ {
} }
void stopSoundMngr()
{
}
/// domain server version for patch /// domain server version for patch
string R2ServerVersion; string R2ServerVersion;
/// name of the version (used to alias many version under the same name), /// name of the version (used to alias many version under the same name),

Loading…
Cancel
Save