From 6b273431458065ba560b3193d092424fb205d73d Mon Sep 17 00:00:00 2001 From: Titus Tscharntke Date: Sun, 3 Jun 2012 17:08:14 +0000 Subject: [PATCH] In system and error messages player names are no longer highlighted in the console with a sound effect as it was very annoying. Just human written chat messages highlight the names. --- source/glest_game/game/chat_manager.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/source/glest_game/game/chat_manager.cpp b/source/glest_game/game/chat_manager.cpp index 0689e01f..74067959 100644 --- a/source/glest_game/game/chat_manager.cpp +++ b/source/glest_game/game/chat_manager.cpp @@ -137,7 +137,7 @@ void ChatManager::keyDown(SDL_KeyboardEvent key) { console->addLine(text,false,playerIndex,Vec3f(1.f, 1.f, 1.f),teamMode); } - gameNetworkInterface->sendTextMessage(text, teamMode? thisTeamIndex: -1, false, ""); + gameNetworkInterface->sendTextMessage("*"+text, teamMode? thisTeamIndex: -1, false, ""); if(inMenu == false) { editEnabled= false; } @@ -430,20 +430,22 @@ void ChatManager::updateNetwork() { if(teamIndex == -1 || teamIndex == thisTeamIndex) { if(msg.targetLanguage == "" || lang.isLanguageLocal(msg.targetLanguage) == true) { bool teamMode = (teamIndex != -1 && teamIndex == thisTeamIndex); - console->addLine(msg.chatText, true, msg.chatPlayerIndex,Vec3f(1.f, 1.f, 1.f),teamMode); - - //!!! string playerName = gameNetworkInterface->getHumanPlayerName(); - if(this->manualPlayerNameOverride != "") { playerName = this->manualPlayerNameOverride; } - if(msg.chatText.find(playerName) != string::npos){ + + if(StartsWith(msg.chatText,"*") && msg.chatText.find(playerName) != string::npos){ CoreData &coreData= CoreData::getInstance(); SoundRenderer &soundRenderer= SoundRenderer::getInstance(); soundRenderer.playFx(coreData.getHighlightSound()); + console->addLine(msg.chatText.substr(1,msg.chatText.size()), true, msg.chatPlayerIndex,Vec3f(1.f, 1.f, 1.f),teamMode); } + else { + console->addLine(msg.chatText, true, msg.chatPlayerIndex,Vec3f(1.f, 1.f, 1.f),teamMode); + } + } SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s] Added text to console\n",__FILE__,__FUNCTION__);