瀏覽代碼

always sound at chat message

Laserlicht 2 年之前
父節點
當前提交
bcf32984ce
共有 1 個文件被更改,包括 7 次插入1 次删除
  1. 7 1
      client/adventureMap/CInGameConsole.cpp

+ 7 - 1
client/adventureMap/CInGameConsole.cpp

@@ -105,7 +105,13 @@ void CInGameConsole::print(const std::string & txt)
 	}
 
 	GH.windows().totalRedraw(); // FIXME: ingame console has no parent widget set
-	CCS->soundh->playSound(AudioPath::builtin("CHAT"));
+
+	int volume = CCS->soundh->getVolume();
+	if(volume == 0)
+		CCS->soundh->setVolume(settings["general"]["sound"].Integer());
+	int handle = CCS->soundh->playSound(AudioPath::builtin("CHAT"));
+	if(volume == 0)
+		CCS->soundh->setCallback(handle, [&]() { CCS->soundh->setVolume(0); });
 }
 
 bool CInGameConsole::captureThisKey(EShortcut key)