diff options
Diffstat (limited to 'src/actions/commands.cpp')
-rw-r--r-- | src/actions/commands.cpp | 30 |
1 files changed, 30 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) |