diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-08-24 01:28:28 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-08-24 01:28:28 +0300 |
commit | e22f6d0070ea2b0102caf3b738fba703606e6bd4 (patch) | |
tree | e40148f0e08490d6f3ea4a3f480739c717d9a70a /src/gui/windows | |
parent | 7f62fc6f4a1765d10cca3977cfbfe1917e4596fe (diff) | |
download | plus-e22f6d0070ea2b0102caf3b738fba703606e6bd4.tar.gz plus-e22f6d0070ea2b0102caf3b738fba703606e6bd4.tar.bz2 plus-e22f6d0070ea2b0102caf3b738fba703606e6bd4.tar.xz plus-e22f6d0070ea2b0102caf3b738fba703606e6bd4.zip |
First step of removing local pets (tmwa only).
Diffstat (limited to 'src/gui/windows')
-rw-r--r-- | src/gui/windows/chatwindow.cpp | 98 | ||||
-rw-r--r-- | src/gui/windows/chatwindow.h | 15 | ||||
-rw-r--r-- | src/gui/windows/minimap.cpp | 3 |
3 files changed, 5 insertions, 111 deletions
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index 6685852fb..85284d4a2 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -1611,32 +1611,19 @@ bool ChatWindow::resortChatLog(std::string line, { if (line.find(": \302\202\302e") != std::string::npos) { - const std::string nick = line.substr(0, idx2 - 1); - line = line.substr(idx2 + 6); - localPetEmote(nick, CAST_U8( - atoi(line.c_str()))); + // Do nothing. Before was local pet emote } else if (line.find(": \302\202\302m") != std::string::npos) { - const std::string nick = line.substr(0, idx2 - 1); - line = line.substr(idx2 + 6); - int x = 0; - int y = 0; - if (parse2Int(line, x, y)) - localPetMove(nick, x, y); + // Do nothing. Before was local pet move } else if (line.find(": \302\202\302d") != std::string::npos) { - const std::string nick = line.substr(0, idx2 - 1); - line = line.substr(idx2 + 6); - localPetDirection(nick, CAST_U8( - atoi(line.c_str()))); + // Do nothing. Before was local pet direction } else if (line.find(": \302\202\302a") != std::string::npos) { - const std::string nick = line.substr(0, idx2 - 1); - line = line.substr(idx2 + 6); - localPetAi(nick, atoi(line.c_str()) ? true : false); + // Do nothing. Before was local pet ai enable/disable } // ignore other special message formats. return false; @@ -1645,13 +1632,7 @@ bool ChatWindow::resortChatLog(std::string line, // pet talk message detected if (line.find(": \302\202\303 ") != std::string::npos) { - if (actorManager && idx2 > 1) - { - const std::string nick = line.substr(0, idx2 - 1); - line = line.substr(idx2 + 6); - localPetSay(nick, line); - } - + // Do nothing. Before was local pet talk return false; } @@ -1750,75 +1731,6 @@ void ChatWindow::channelChatLog(const std::string &channel, tab->chatLog(line, own, ignoreRecord, tryRemoveColors); } -static Being *getPetForNick(const std::string &nick) -{ - Being *const being = actorManager->findBeingByName( - nick, ActorType::Player); - if (being) - 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; - if (pet) - { - // TRANSLATORS: owners pet name. For example: 4144's pet - localChatTab->chatLog(strprintf(_("%s's pet"), nick.c_str()), text); - } - else - { - localChatTab->chatLog(nick, text); - } -} - -void ChatWindow::localPetEmote(const std::string &nick, const uint8_t emoteId) -{ - Being *const pet = getPetForNick(nick); - if (pet) - pet->setEmote(emoteId, 0); -} - -void ChatWindow::localPetAi(const std::string &nick, const bool start) -{ - Being *const pet = getPetForNick(nick); - if (pet) - { - if (start) - pet->enablePetAi(); - else - pet->disablePetAi(); - } -} - -void ChatWindow::localPetMove(const std::string &nick, - const int x, const int y) -{ - Being *const pet = getPetForNick(nick); - if (pet) - { - pet->setDestination(x, y); - pet->disablePetAi(); - } -} - -void ChatWindow::localPetDirection(const std::string &nick, - uint8_t dir) -{ - Being *const pet = getPetForNick(nick); - if (pet) - { - pet->setDirection(dir); - pet->disablePetAi(); - } -} - void ChatWindow::initTradeFilter() { const std::string tradeListName = settings.serverConfigDir diff --git a/src/gui/windows/chatwindow.h b/src/gui/windows/chatwindow.h index 5032d337a..78d87eb6d 100644 --- a/src/gui/windows/chatwindow.h +++ b/src/gui/windows/chatwindow.h @@ -302,21 +302,6 @@ class ChatWindow final : public Window, const int oldVal1, const int oldVal2) override final; - static void localPetSay(const std::string &nick, - const std::string &text); - - static void localPetEmote(const std::string &nick, - const uint8_t emoteId); - - static void localPetMove(const std::string &nick, - const int x, const int y); - - static void localPetDirection(const std::string &nick, - uint8_t dir); - - static void localPetAi(const std::string &nick, - const bool start); - void postConnection(); void showGMTab(); diff --git a/src/gui/windows/minimap.cpp b/src/gui/windows/minimap.cpp index d21700455..24cf57743 100644 --- a/src/gui/windows/minimap.cpp +++ b/src/gui/windows/minimap.cpp @@ -355,9 +355,6 @@ void Minimap::draw2(Graphics *const graphics) type = UserColorId::PORTAL_HIGHLIGHT; break; -#ifdef TMWA_SUPPORT - case ActorType::LocalPet: -#endif case ActorType::Pet: type = UserColorId::PET; break; |