summaryrefslogtreecommitdiff
path: root/src/actions
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-12-12 20:29:50 +0300
committerAndrei Karas <akaras@inbox.ru>2014-12-12 20:29:50 +0300
commit645553c783c2cacb1ed140aa53792c35c3b971d2 (patch)
treefe47d96a441ca3be35c0747b4494677d023df6c2 /src/actions
parentb07ac409f1940d3767c8e4ade0990d11d2d38b96 (diff)
downloadplus-645553c783c2cacb1ed140aa53792c35c3b971d2.tar.gz
plus-645553c783c2cacb1ed140aa53792c35c3b971d2.tar.bz2
plus-645553c783c2cacb1ed140aa53792c35c3b971d2.tar.xz
plus-645553c783c2cacb1ed140aa53792c35c3b971d2.zip
Add chat command for move to being location.
New chat command: /navigateto NAME
Diffstat (limited to 'src/actions')
-rw-r--r--src/actions/commands.cpp30
-rw-r--r--src/actions/commands.h1
2 files changed, 31 insertions, 0 deletions
diff --git a/src/actions/commands.cpp b/src/actions/commands.cpp
index 151e54474..00c8b9a5c 100644
--- a/src/actions/commands.cpp
+++ b/src/actions/commands.cpp
@@ -25,6 +25,7 @@
#include "flooritem.h"
#include "inventory.h"
#include "item.h"
+#include "party.h"
#include "actions/actiondef.h"
@@ -442,6 +443,35 @@ impHandler(navigate)
return true;
}
+impHandler(navigateTo)
+{
+ if (!localPlayer)
+ return false;
+
+ const std::string args = event.args;
+ if (args.empty())
+ return true;
+
+ Being *const being = actorManager->findBeingByName(args);
+ if (being)
+ {
+ localPlayer->navigateTo(being->getTileX(), being->getTileY());
+ }
+ else if (localPlayer->isInParty())
+ {
+ const Party *const party = localPlayer->getParty();
+ if (party)
+ {
+ const PartyMember *const m = party->getMember(args);
+ const PartyMember *const o = party->getMember(
+ localPlayer->getName());
+ if (m && o && m->getMap() == o->getMap())
+ localPlayer->navigateTo(m->getX(), m->getY());
+ }
+ }
+ return true;
+}
+
impHandler(imitation)
{
if (!localPlayer)
diff --git a/src/actions/commands.h b/src/actions/commands.h
index 34dcf0c44..a8143275b 100644
--- a/src/actions/commands.h
+++ b/src/actions/commands.h
@@ -49,6 +49,7 @@ namespace Actions
decHandler(pseudoAway);
decHandler(follow);
decHandler(navigate);
+ decHandler(navigateTo);
decHandler(imitation);
decHandler(sendMail);
decHandler(info);