From ed7e9fa4c89cc6e42dabe33d14f08db9cac38b5e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 25 May 2015 15:04:04 +0300 Subject: Fix buy/sell from personal shop in player stand very close to npc. --- src/actions/actions.cpp | 18 ++++++++++++------ 1 file 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 &players = whoIsOnline->getOnlineNicks(); @@ -639,6 +639,9 @@ impHandler(buy) return false; } + if (!being) + being = findBeing(args, true); + if (!being) return false; @@ -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 &players = whoIsOnline->getOnlineNicks(); @@ -675,6 +678,9 @@ impHandler(sell) return false; } + if (!being) + being = findBeing(args, true); + if (!being) return false; @@ -698,7 +704,7 @@ impHandler(sell) impHandler(talk) { - Being *being = findBeing(event.args); + Being *being = findBeing(event.args, true); if (!being) return false; -- cgit v1.2.3-70-g09d2