1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00
This commit is contained in:
Laserlicht
2023-09-19 09:52:32 +02:00
committed by GitHub
parent bcf32984ce
commit 6ae09d8458

View File

@@ -228,14 +228,22 @@ CInfoBar::VisibleComponentInfo::VisibleComponentInfo(const std::vector<Component
void CInfoBar::playNewDaySound()
{
int volume = CCS->soundh->getVolume();
int handle = -1;
if(volume == 0)
CCS->soundh->setVolume(settings["general"]["sound"].Integer());
if(LOCPLINT->cb->getDate(Date::DAY_OF_WEEK) != 1) // not first day of the week
CCS->soundh->playSound(soundBase::newDay);
handle = CCS->soundh->playSound(soundBase::newDay);
else if(LOCPLINT->cb->getDate(Date::WEEK) != 1) // not first week in month
CCS->soundh->playSound(soundBase::newWeek);
handle = CCS->soundh->playSound(soundBase::newWeek);
else if(LOCPLINT->cb->getDate(Date::MONTH) != 1) // not first month
CCS->soundh->playSound(soundBase::newMonth);
handle = CCS->soundh->playSound(soundBase::newMonth);
else
CCS->soundh->playSound(soundBase::newDay);
handle = CCS->soundh->playSound(soundBase::newDay);
if(volume == 0)
CCS->soundh->setCallback(handle, [&]() { CCS->soundh->setVolume(0); });
}
void CInfoBar::reset()