summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-12-28 17:07:33 +0300
committerAndrei Karas <akaras@inbox.ru>2014-12-28 17:07:33 +0300
commit2cfa0d17583869b7a2fb6e558b160e46389f5599 (patch)
treef47e37d1c955365f9173ab53a1e9602e29903096 /src/gui
parent4e7669dd6e07658fa86878d1e64c482a094b3b19 (diff)
downloadmanaplus-2cfa0d17583869b7a2fb6e558b160e46389f5599.tar.gz
manaplus-2cfa0d17583869b7a2fb6e558b160e46389f5599.tar.bz2
manaplus-2cfa0d17583869b7a2fb6e558b160e46389f5599.tar.xz
manaplus-2cfa0d17583869b7a2fb6e558b160e46389f5599.zip
Impliment actual move actions from pet commands.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/windows/chatwindow.cpp25
-rw-r--r--src/gui/windows/chatwindow.h3
2 files changed, 28 insertions, 0 deletions
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp
index 524256dd4..7f6c2e731 100644
--- a/src/gui/windows/chatwindow.cpp
+++ b/src/gui/windows/chatwindow.cpp
@@ -1513,6 +1513,15 @@ bool ChatWindow::resortChatLog(std::string line,
localPetEmote(nick, static_cast<uint8_t>(
atoi(line.c_str())));
}
+ 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);
+ }
// ignore other special message formats.
return false;
}
@@ -1670,6 +1679,22 @@ void ChatWindow::localPetEmote(const std::string &nick, const uint8_t emoteId)
}
}
+void ChatWindow::localPetMove(const std::string &nick,
+ const int x, const int y)
+{
+ Being *const being = actorManager->findBeingByName(
+ nick, ActorType::Player);
+ if (being)
+ {
+ Being *const pet = being->getFirstPet();
+ if (pet)
+ {
+ pet->setDestination(x, y);
+ 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 a6bf15384..1b22ee05f 100644
--- a/src/gui/windows/chatwindow.h
+++ b/src/gui/windows/chatwindow.h
@@ -297,6 +297,9 @@ class ChatWindow final : public Window,
static void localPetEmote(const std::string &nick,
const uint8_t emoteId);
+ static void localPetMove(const std::string &nick,
+ const int x, const int y);
+
void postConnection();
#ifdef USE_PROFILER