From 5b0a3c0b6ab7aa82a1ffcec4ec48a0540f8d4108 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 22 Dec 2014 20:17:58 +0300 Subject: Fix /buy and /sell commands for players outside of visible range. --- src/actions/actions.cpp | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'src/actions/actions.cpp') diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp index 003cd4a5d..cddaaddcb 100644 --- a/src/actions/actions.cpp +++ b/src/actions/actions.cpp @@ -58,6 +58,7 @@ #include "gui/windows/shopwindow.h" #include "gui/windows/shortcutwindow.h" #include "gui/windows/skilldialog.h" +#include "gui/windows/whoisonline.h" #include "gui/widgets/tabs/chat/chattab.h" @@ -617,9 +618,18 @@ impHandler0(ignoreInput) impHandler(buy) { - Being *being = findBeing(event.args); + const std::string args = event.args; + Being *being = findBeing(args); if (!being) + { + const std::set &players = whoIsOnline->getOnlineNicks(); + if (players.find(args) != players.end()) + { + buySellHandler->requestSellList(args); + return true; + } return false; + } if (being->getType() == ActorType::Npc) { @@ -636,9 +646,18 @@ impHandler(buy) impHandler(sell) { - Being *being = findBeing(event.args); + const std::string args = event.args; + Being *being = findBeing(args); if (!being) + { + const std::set &players = whoIsOnline->getOnlineNicks(); + if (players.find(args) != players.end()) + { + buySellHandler->requestBuyList(args); + return true; + } return false; + } if (being->getType() == ActorType::Npc) { -- cgit v1.2.3-60-g2f50