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

Integrated CClientState into GameEngine class

This commit is contained in:
Ivan Savenko
2025-02-10 22:08:50 +00:00
parent cacceda950
commit f657e85305
51 changed files with 240 additions and 275 deletions

View File

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