summaryrefslogtreecommitdiff
path: root/src/gui/windows/chatwindow.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-08-24 01:28:28 +0300
committerAndrei Karas <akaras@inbox.ru>2016-08-24 01:28:28 +0300
commite22f6d0070ea2b0102caf3b738fba703606e6bd4 (patch)
treee40148f0e08490d6f3ea4a3f480739c717d9a70a /src/gui/windows/chatwindow.cpp
parent7f62fc6f4a1765d10cca3977cfbfe1917e4596fe (diff)
downloadmv-e22f6d0070ea2b0102caf3b738fba703606e6bd4.tar.gz
mv-e22f6d0070ea2b0102caf3b738fba703606e6bd4.tar.bz2
mv-e22f6d0070ea2b0102caf3b738fba703606e6bd4.tar.xz
mv-e22f6d0070ea2b0102caf3b738fba703606e6bd4.zip
First step of removing local pets (tmwa only).
Diffstat (limited to 'src/gui/windows/chatwindow.cpp')
-rw-r--r--src/gui/windows/chatwindow.cpp98
1 files changed, 5 insertions, 93 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