From 19b82b4dad9b66418a4e7d0ed0ba23d0cab17216 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 16 Dec 2017 02:19:08 +0300 Subject: Remove default parameters from Being::setSpeech. --- src/being/being.cpp | 20 +++++--------------- src/being/being.h | 4 +--- src/net/eathena/chatrecv.cpp | 4 ++-- src/net/tmwa/chatrecv.cpp | 27 +++++++++++---------------- src/net/tmwa/chatrecv.h | 3 +-- 5 files changed, 20 insertions(+), 38 deletions(-) (limited to 'src') diff --git a/src/being/being.cpp b/src/being/being.cpp index 61826f494..8cd80d4dc 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -564,19 +564,11 @@ void Being::setPath(const Path &restrict path) restrict2 } } -void Being::setSpeech(const std::string &restrict text, - const std::string &restrict channel, - int time) restrict2 +void Being::setSpeech(const std::string &restrict text) restrict2 { if (userPalette == nullptr) return; - if (!channel.empty() && - ((langChatTab == nullptr) || langChatTab->getChannelName() != channel)) - { - return; - } - // Remove colors mSpeech = removeColors(text); @@ -591,12 +583,10 @@ void Being::setSpeech(const std::string &restrict text, if (mSpeech.empty()) return; - if (time == 0) - { - const size_t sz = mSpeech.size(); - if (sz < 200) - time = CAST_S32(SPEECH_TIME - 300 + (3 * sz)); - } + const size_t sz = mSpeech.size(); + int time = 0; + if (sz < 200) + time = CAST_S32(SPEECH_TIME - 300 + (3 * sz)); if (time < CAST_S32(SPEECH_MIN_TIME)) time = CAST_S32(SPEECH_MIN_TIME); diff --git a/src/being/being.h b/src/being/being.h index feb686740..64a193c46 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -185,9 +185,7 @@ class Being notfinal : public ActorSprite, * @param text The text that should appear. * @param time The amount of time the text should stay in milliseconds. */ - void setSpeech(const std::string &restrict text, - const std::string &restrict channel = "", - int time = 0) restrict2; + void setSpeech(const std::string &restrict text) restrict2; /** * Puts a damage bubble above this being. diff --git a/src/net/eathena/chatrecv.cpp b/src/net/eathena/chatrecv.cpp index 2748d76d7..60033bf55 100644 --- a/src/net/eathena/chatrecv.cpp +++ b/src/net/eathena/chatrecv.cpp @@ -262,7 +262,7 @@ void ChatRecv::processChatContinue(std::string chatMsg, if (localPlayer != nullptr) { if (((chatWindow != nullptr) || Ea::ChatRecv::mShowMotd) && allow) - localPlayer->setSpeech(chatMsg, GENERAL_CHANNEL); + localPlayer->setSpeech(chatMsg); } BLOCK_END("ChatRecv::processChat") } @@ -563,7 +563,7 @@ void ChatRecv::processBeingChat(Net::MessageIn &msg) playerRelations.hasPermission(sender_name, PlayerRelation::SPEECH_FLOAT)) { - being->setSpeech(chatMsg, GENERAL_CHANNEL); + being->setSpeech(chatMsg); } BLOCK_END("ChatRecv::processBeingChat") } diff --git a/src/net/tmwa/chatrecv.cpp b/src/net/tmwa/chatrecv.cpp index a23dc92a4..42cac06f4 100644 --- a/src/net/tmwa/chatrecv.cpp +++ b/src/net/tmwa/chatrecv.cpp @@ -59,11 +59,10 @@ void ChatRecv::processChat(Net::MessageIn &msg) return; } - processChatContinue(msg.readRawString(chatMsgLength, "message"), ""); + processChatContinue(msg.readRawString(chatMsgLength, "message")); } -void ChatRecv::processChatContinue(std::string chatMsg, - const std::string &channel) +void ChatRecv::processChatContinue(std::string chatMsg) { const size_t pos = chatMsg.find(" : ", 0); @@ -72,25 +71,21 @@ void ChatRecv::processChatContinue(std::string chatMsg, { allow = chatWindow->resortChatLog(chatMsg, ChatMsgType::BY_PLAYER, - channel, + GENERAL_CHANNEL, IgnoreRecord_false, TryRemoveColors_true); } - if (channel.empty()) + const std::string senseStr("You sense the following: "); + if ((actorManager != nullptr) && (chatMsg.find(senseStr) == 0u)) { - const std::string senseStr("You sense the following: "); - if ((actorManager != nullptr) && (chatMsg.find(senseStr) == 0u)) - { - actorManager->parseLevels( - chatMsg.substr(senseStr.size())); - } + actorManager->parseLevels( + chatMsg.substr(senseStr.size())); } if (pos == std::string::npos && !Ea::ChatRecv::mShowMotd && - Ea::ChatRecv::mSkipping && - channel.empty()) + Ea::ChatRecv::mSkipping) { // skip motd from "new" tmw server if (Ea::ChatRecv::mMotdTime == 0) @@ -113,8 +108,8 @@ void ChatRecv::processChatContinue(std::string chatMsg, if (localPlayer != nullptr) { - if (((chatWindow != nullptr) || Ea::ChatRecv::mShowMotd) && allow) - localPlayer->setSpeech(chatMsg, channel); + if ((chatWindow != nullptr || Ea::ChatRecv::mShowMotd) && allow) + localPlayer->setSpeech(chatMsg); } BLOCK_END("ChatRecv::processChat") } @@ -367,7 +362,7 @@ void ChatRecv::processBeingChat(Net::MessageIn &msg) playerRelations.hasPermission(sender_name, PlayerRelation::SPEECH_FLOAT)) { - being->setSpeech(chatMsg, GENERAL_CHANNEL); + being->setSpeech(chatMsg); } BLOCK_END("ChatRecv::processBeingChat") } diff --git a/src/net/tmwa/chatrecv.h b/src/net/tmwa/chatrecv.h index 3e7b58b15..d5995d8ef 100644 --- a/src/net/tmwa/chatrecv.h +++ b/src/net/tmwa/chatrecv.h @@ -35,8 +35,7 @@ namespace TmwAthena namespace ChatRecv { void processChat(Net::MessageIn &msg); - void processChatContinue(std::string chatMsg, - const std::string &channel); + void processChatContinue(std::string chatMsg); void processGmChat(Net::MessageIn &msg); void processWhisper(Net::MessageIn &msg); void processWhisperResponse(Net::MessageIn &msg); -- cgit v1.2.3-60-g2f50