summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-12-28 19:48:10 +0300
committerAndrei Karas <akaras@inbox.ru>2014-12-28 19:48:10 +0300
commit0aed9de1042c212ae3edc00994d3efaf26176202 (patch)
tree983540cef494aad769eb12417c8ac165f046db97 /src
parent76ac66f1ad795bb10753572d967d7f9215086897 (diff)
downloadmanaverse-0aed9de1042c212ae3edc00994d3efaf26176202.tar.gz
manaverse-0aed9de1042c212ae3edc00994d3efaf26176202.tar.bz2
manaverse-0aed9de1042c212ae3edc00994d3efaf26176202.tar.xz
manaverse-0aed9de1042c212ae3edc00994d3efaf26176202.zip
Improve function localPetSay.
Diffstat (limited to 'src')
-rw-r--r--src/gui/windows/chatwindow.cpp26
1 files changed, 10 insertions, 16 deletions
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp
index a707ac8c4..a3c7f703f 100644
--- a/src/gui/windows/chatwindow.cpp
+++ b/src/gui/windows/chatwindow.cpp
@@ -1655,17 +1655,20 @@ void ChatWindow::channelChatLog(const std::string &channel,
tab->chatLog(line, own, ignoreRecord, tryRemoveColors);
}
-void ChatWindow::localPetSay(const std::string &nick, const std::string &text)
+static Being *getPetForNick(const std::string &nick)
{
Being *const being = actorManager->findBeingByName(
nick, ActorType::Player);
- Being *pet = nullptr;
if (being)
- {
- pet = being->getFirstPet();
- if (pet)
- pet->setSpeech(text, GENERAL_CHANNEL);
- }
+ return being->getFirstPet();
+ return nullptr;
+}
+
+void ChatWindow::localPetSay(const std::string &nick, const std::string &text)
+{
+ Being *const pet = getPetForNick(nick);
+ if (pet)
+ pet->setSpeech(text, GENERAL_CHANNEL);
if (!localChatTab)
return;
@@ -1680,15 +1683,6 @@ void ChatWindow::localPetSay(const std::string &nick, const std::string &text)
}
}
-static Being *getPetForNick(const std::string &nick)
-{
- Being *const being = actorManager->findBeingByName(
- nick, ActorType::Player);
- if (being)
- return being->getFirstPet();
- return nullptr;
-}
-
void ChatWindow::localPetEmote(const std::string &nick, const uint8_t emoteId)
{
Being *const pet = getPetForNick(nick);