diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-12-28 19:48:10 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-12-28 19:48:10 +0300 |
commit | 0aed9de1042c212ae3edc00994d3efaf26176202 (patch) | |
tree | 983540cef494aad769eb12417c8ac165f046db97 | |
parent | 76ac66f1ad795bb10753572d967d7f9215086897 (diff) | |
download | mv-0aed9de1042c212ae3edc00994d3efaf26176202.tar.gz mv-0aed9de1042c212ae3edc00994d3efaf26176202.tar.bz2 mv-0aed9de1042c212ae3edc00994d3efaf26176202.tar.xz mv-0aed9de1042c212ae3edc00994d3efaf26176202.zip |
Improve function localPetSay.
-rw-r--r-- | src/gui/windows/chatwindow.cpp | 26 |
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); |