From 5d7901cd8cfa63194c1cf8f3569f8edade321efa Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Fri, 22 Dec 2023 22:46:29 +0200 Subject: [PATCH] Fixed timer countdown sound playback --- client/adventureMap/TurnTimerWidget.cpp | 11 ++++++----- client/adventureMap/TurnTimerWidget.h | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/client/adventureMap/TurnTimerWidget.cpp b/client/adventureMap/TurnTimerWidget.cpp index 78e13d3d2..95effa225 100644 --- a/client/adventureMap/TurnTimerWidget.cpp +++ b/client/adventureMap/TurnTimerWidget.cpp @@ -104,13 +104,14 @@ void TurnTimerWidget::show(Canvas & to) void TurnTimerWidget::updateNotifications(PlayerColor player, int timeMs) { + if(player != LOCPLINT->playerID) + return; + int newTimeSeconds = timeMs / 1000; - if(player == LOCPLINT->playerID - && newTimeSeconds != lastSoundCheckSeconds - && notificationThresholds.count(newTimeSeconds)) - { + + if (newTimeSeconds != lastSoundCheckSeconds && notificationThresholds.count(newTimeSeconds)) CCS->soundh->playSound(AudioPath::builtin("WE5")); - } + lastSoundCheckSeconds = newTimeSeconds; } diff --git a/client/adventureMap/TurnTimerWidget.h b/client/adventureMap/TurnTimerWidget.h index 5af6739ea..1077db031 100644 --- a/client/adventureMap/TurnTimerWidget.h +++ b/client/adventureMap/TurnTimerWidget.h @@ -28,7 +28,7 @@ class TurnTimerWidget : public CIntObject int lastSoundCheckSeconds; bool isBattleMode; - const std::set notificationThresholds = {0, 1, 2, 3, 4, 5, 10, 20, 30}; + const std::set notificationThresholds = {1, 2, 3, 4, 5, 10, 20, 30}; std::map> playerLabelsMain; std::map> playerLabelsBattle;