diff options
-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); |