diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-05-25 15:04:04 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-05-25 15:04:04 +0300 |
commit | ed7e9fa4c89cc6e42dabe33d14f08db9cac38b5e (patch) | |
tree | 8d63f32c1e12c96ca00855089d78d5806e54e60f /src/actions | |
parent | b32500a2241cc7fbd21e0996e77d0ce0875a33fc (diff) | |
download | manaverse-ed7e9fa4c89cc6e42dabe33d14f08db9cac38b5e.tar.gz manaverse-ed7e9fa4c89cc6e42dabe33d14f08db9cac38b5e.tar.bz2 manaverse-ed7e9fa4c89cc6e42dabe33d14f08db9cac38b5e.tar.xz manaverse-ed7e9fa4c89cc6e42dabe33d14f08db9cac38b5e.zip |
Fix buy/sell from personal shop in player stand very close to npc.
Diffstat (limited to 'src/actions')
-rw-r--r-- | src/actions/actions.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp index caef71b01..aacd40406 100644 --- a/src/actions/actions.cpp +++ b/src/actions/actions.cpp @@ -177,7 +177,7 @@ static void uploadFile(const std::string &str, upload->start(); } -static Being *findBeing(const std::string &name) +static Being *findBeing(const std::string &name, const bool npc) { if (!localPlayer || !actorManager) return nullptr; @@ -193,7 +193,7 @@ static Being *findBeing(const std::string &name) being = actorManager->findBeingByName( name, ActorType::Unknown); } - if (!being) + if (!being && npc) { being = actorManager->findNearestLivingBeing( localPlayer, 1, ActorType::Npc, AllowSort_true); @@ -206,7 +206,7 @@ static Being *findBeing(const std::string &name) } } } - if (!being) + if (!being && npc) { being = actorManager->findNearestLivingBeing( localPlayer, 1, ActorType::Player, AllowSort_true); @@ -627,7 +627,7 @@ impHandler0(ignoreInput) impHandler(buy) { const std::string args = event.args; - Being *being = findBeing(args); + Being *being = findBeing(args, false); if (!being && !serverFeatures->haveVending()) { const std::set<std::string> &players = whoIsOnline->getOnlineNicks(); @@ -640,6 +640,9 @@ impHandler(buy) } if (!being) + being = findBeing(args, true); + + if (!being) return false; if (being->getType() == ActorType::Npc) @@ -663,7 +666,7 @@ impHandler(buy) impHandler(sell) { const std::string args = event.args; - Being *being = findBeing(args); + Being *being = findBeing(args, false); if (!being && !serverFeatures->haveVending()) { const std::set<std::string> &players = whoIsOnline->getOnlineNicks(); @@ -676,6 +679,9 @@ impHandler(sell) } if (!being) + being = findBeing(args, true); + + if (!being) return false; if (being->getType() == ActorType::Npc) @@ -698,7 +704,7 @@ impHandler(sell) impHandler(talk) { - Being *being = findBeing(event.args); + Being *being = findBeing(event.args, true); if (!being) return false; |