From 48eb8ab54f9992eff22a27af54e9d87b9e02cd97 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Mon, 3 Jul 2023 17:12:31 +0300 Subject: [PATCH] Play sound when receiving message, not just on sending ours --- client/adventureMap/CInGameConsole.cpp | 6 +----- server/CGameHandler.cpp | 14 ++++++++------ 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/client/adventureMap/CInGameConsole.cpp b/client/adventureMap/CInGameConsole.cpp index 735a92ac4..ea8f52d33 100644 --- a/client/adventureMap/CInGameConsole.cpp +++ b/client/adventureMap/CInGameConsole.cpp @@ -104,6 +104,7 @@ void CInGameConsole::print(const std::string & txt) } GH.windows().totalRedraw(); // FIXME: ingame console has no parent widget set + CCS->soundh->playSound("CHAT"); } void CInGameConsole::keyPressed (EShortcut key) @@ -134,11 +135,6 @@ void CInGameConsole::keyPressed (EShortcut key) { bool anyTextExceptCaret = enteredText.size() > 1; endEnteringText(anyTextExceptCaret); - - if(anyTextExceptCaret) - { - CCS->soundh->playSound("CHAT"); - } } break; } diff --git a/server/CGameHandler.cpp b/server/CGameHandler.cpp index b26b0abd2..24aa8357f 100644 --- a/server/CGameHandler.cpp +++ b/server/CGameHandler.cpp @@ -4980,12 +4980,6 @@ void CGameHandler::playerMessage(PlayerColor player, const std::string &message, { bool cheated = false; - if(!getPlayerSettings(player)->isControlledByAI()) - { - PlayerMessageClient temp_message(player, message); - sendAndApply(&temp_message); - } - std::vector words; boost::split(words, message, boost::is_any_of(" ")); @@ -5106,6 +5100,14 @@ void CGameHandler::playerMessage(PlayerColor player, const std::string &message, if(!player.isSpectator()) checkVictoryLossConditionsForPlayer(player);//Player enter win code or got required art\creature } + else + { + if(!getPlayerSettings(player)->isControlledByAI()) + { + PlayerMessageClient temp_message(player, message); + sendAndApply(&temp_message); + } + } } bool CGameHandler::makeCustomAction(BattleAction & ba)