summaryrefslogtreecommitdiff
path: root/src/actions/actions.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-12-22 20:17:58 +0300
committerAndrei Karas <akaras@inbox.ru>2014-12-22 20:17:58 +0300
commit5b0a3c0b6ab7aa82a1ffcec4ec48a0540f8d4108 (patch)
tree7f11d2461f672e6fd414946d359babdc13e323b6 /src/actions/actions.cpp
parentc860fb83abb48b98f98e20fc19ac1591d03b61d1 (diff)
downloadmanaplus-5b0a3c0b6ab7aa82a1ffcec4ec48a0540f8d4108.tar.gz
manaplus-5b0a3c0b6ab7aa82a1ffcec4ec48a0540f8d4108.tar.bz2
manaplus-5b0a3c0b6ab7aa82a1ffcec4ec48a0540f8d4108.tar.xz
manaplus-5b0a3c0b6ab7aa82a1ffcec4ec48a0540f8d4108.zip
Fix /buy and /sell commands for players outside of visible range.
Diffstat (limited to 'src/actions/actions.cpp')
-rw-r--r--src/actions/actions.cpp23
1 files changed, 21 insertions, 2 deletions
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<std::string> &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<std::string> &players = whoIsOnline->getOnlineNicks();
+ if (players.find(args) != players.end())
+ {
+ buySellHandler->requestBuyList(args);
+ return true;
+ }
return false;
+ }
if (being->getType() == ActorType::Npc)
{