diff --git a/client/BattleInterface/CBattleInterface.cpp b/client/BattleInterface/CBattleInterface.cpp index 11928b427..6271c1ed6 100644 --- a/client/BattleInterface/CBattleInterface.cpp +++ b/client/BattleInterface/CBattleInterface.cpp @@ -1515,7 +1515,7 @@ bool CBattleInterface::isCatapultAttackable(BattleHex hex) const return false; int wallUnder = curInt->cb->battleHexToWallPart(hex); - if(wallUnder == -1) + if(wallUnder < 0) //invalid or indestructible return false; return curInt->cb->battleGetWallState(wallUnder) < EWallState::DESTROYED; diff --git a/client/CMusicHandler.cpp b/client/CMusicHandler.cpp index 1785f72f4..600c756b7 100644 --- a/client/CMusicHandler.cpp +++ b/client/CMusicHandler.cpp @@ -426,11 +426,7 @@ void CMusicHandler::queueNext(MusicEntry *queued) next.reset(queued); - if (current.get() != NULL) - { - current->stop(1000); - } - else + if (current.get() == nullptr || !current->stop(1000)) { current.reset(next.release()); current->play(); @@ -480,7 +476,7 @@ void CMusicHandler::musicFinishedCallback(void) MusicEntry::MusicEntry(CMusicHandler *owner, std::string setName, std::string musicURI, bool looped): owner(owner), music(nullptr), - looped(looped), + loop(looped ? -1 : 1), setName(setName) { if (!musicURI.empty()) @@ -521,7 +517,7 @@ void MusicEntry::load(std::string musicURI) bool MusicEntry::play() { - if (!looped && music) //already played once - return + if (!(loop--) && music) //already played once - return return false; if (!setName.empty()) @@ -542,11 +538,16 @@ bool MusicEntry::play() return true; } -void MusicEntry::stop(int fade_ms) +bool MusicEntry::stop(int fade_ms) { - tlog5<<"Stoping music file "<