summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-17 11:59:03 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-17 11:59:03 +0300
commit3aaebb5b7f1faf46d9f437ba00e7650147453952 (patch)
treefa5f0949dd16db6b30b0132a02f33d3fe784acb0
parentc81a850333f6e651e0dddb764e98a0fae45ca5f4 (diff)
downloadplus-3aaebb5b7f1faf46d9f437ba00e7650147453952.tar.gz
plus-3aaebb5b7f1faf46d9f437ba00e7650147453952.tar.bz2
plus-3aaebb5b7f1faf46d9f437ba00e7650147453952.tar.xz
plus-3aaebb5b7f1faf46d9f437ba00e7650147453952.zip
Remove getter for tradeHandler.
-rw-r--r--src/actions/actions.cpp4
-rw-r--r--src/gui/popups/popupmenu.cpp2
-rw-r--r--src/gui/widgets/itemcontainer.cpp3
-rw-r--r--src/gui/windows/shopwindow.cpp2
-rw-r--r--src/gui/windows/tradewindow.cpp14
-rw-r--r--src/listeners/requesttradelistener.h2
-rw-r--r--src/net/net.cpp7
-rw-r--r--src/net/net.h4
-rw-r--r--src/net/tradehandler.h2
9 files changed, 16 insertions, 24 deletions
diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp
index b857f0f10..1c6fc3194 100644
--- a/src/actions/actions.cpp
+++ b/src/actions/actions.cpp
@@ -599,7 +599,7 @@ impHandler0(openTrade)
const Being *const being = localPlayer->getTarget();
if (being && being->getType() == ActorType::Player)
{
- Net::getTradeHandler()->request(being);
+ tradeHandler->request(being);
tradePartnerName = being->getName();
if (tradeWindow)
tradeWindow->clear();
@@ -688,7 +688,7 @@ impHandler(trade)
being = localPlayer->getTarget();
if (being)
{
- Net::getTradeHandler()->request(being);
+ tradeHandler->request(being);
tradePartnerName = being->getName();
if (tradeWindow)
tradeWindow->clear();
diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp
index 31ae42b4a..d9690a11f 100644
--- a/src/gui/popups/popupmenu.cpp
+++ b/src/gui/popups/popupmenu.cpp
@@ -908,7 +908,7 @@ void PopupMenu::handleLink(const std::string &link,
else if (link == "trade" && being &&
being->getType() == ActorType::Player)
{
- Net::getTradeHandler()->request(being);
+ tradeHandler->request(being);
tradePartnerName = being->getName();
if (tradeWindow)
tradeWindow->clear();
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index aa8966620..1d18c3e2e 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -579,8 +579,7 @@ void ItemContainer::mouseReleased(MouseEvent &event)
if (!checkProtection || !PlayerInfo::isItemProtected(
item->getId()))
{
- Net::getTradeHandler()->addItem(item,
- item->getQuantity());
+ tradeHandler->addItem(item, item->getQuantity());
}
}
}
diff --git a/src/gui/windows/shopwindow.cpp b/src/gui/windows/shopwindow.cpp
index e846e0dce..a78a8fbcd 100644
--- a/src/gui/windows/shopwindow.cpp
+++ b/src/gui/windows/shopwindow.cpp
@@ -310,7 +310,7 @@ void ShopWindow::startTrade()
tradeWindow->addAutoItem(mTradeNick, mTradeItem,
mTradeItem->getQuantity());
}
- Net::getTradeHandler()->request(being);
+ tradeHandler->request(being);
tradePartnerName = mTradeNick;
mTradeNick.clear();
}
diff --git a/src/gui/windows/tradewindow.cpp b/src/gui/windows/tradewindow.cpp
index 7707bf360..7f6e78a9b 100644
--- a/src/gui/windows/tradewindow.cpp
+++ b/src/gui/windows/tradewindow.cpp
@@ -273,7 +273,7 @@ void TradeWindow::tradeItem(const Item *const item, const int quantity,
if (check && !checkItem(item))
return;
- Net::getTradeHandler()->addItem(item, quantity);
+ tradeHandler->addItem(item, quantity);
}
void TradeWindow::valueChanged(const SelectionEvent &event)
@@ -365,7 +365,7 @@ void TradeWindow::action(const ActionEvent &event)
setVisible(false);
reset();
PlayerInfo::setTrading(false);
- Net::getTradeHandler()->cancel();
+ tradeHandler->cancel();
}
else if (eventId == "ok")
{
@@ -374,13 +374,13 @@ void TradeWindow::action(const ActionEvent &event)
mMoneyChangeButton->setEnabled(false);
receivedOk(true);
setStatus(PROPOSING);
- Net::getTradeHandler()->confirm();
+ tradeHandler->confirm();
}
else if (eventId == "trade")
{
receivedOk(true);
setStatus(ACCEPTED);
- Net::getTradeHandler()->finish();
+ tradeHandler->finish();
}
else if (eventId == "money")
{
@@ -399,14 +399,14 @@ void TradeWindow::action(const ActionEvent &event)
}
v = curMoney;
}
- Net::getTradeHandler()->setMoney(v);
+ tradeHandler->setMoney(v);
mMoneyField->setText(strprintf("%d", v));
}
}
void TradeWindow::close()
{
- Net::getTradeHandler()->cancel();
+ tradeHandler->cancel();
clear();
}
@@ -457,7 +457,7 @@ void TradeWindow::initTrade(const std::string &nick)
}
if (mAutoMoney)
{
- Net::getTradeHandler()->setMoney(mAutoMoney);
+ tradeHandler->setMoney(mAutoMoney);
mMoneyField->setText(strprintf("%d", mAutoMoney));
}
}
diff --git a/src/listeners/requesttradelistener.h b/src/listeners/requesttradelistener.h
index 6d549dcfd..494732d00 100644
--- a/src/listeners/requesttradelistener.h
+++ b/src/listeners/requesttradelistener.h
@@ -50,7 +50,7 @@ struct RequestTradeListener final : public ActionListener
const std::string &eventId = event.getId();
if (eventId == "ignore")
player_relations.ignoreTrade(tradePartnerName);
- Net::getTradeHandler()->respond(eventId == "yes");
+ tradeHandler->respond(eventId == "yes");
}
};
diff --git a/src/net/net.cpp b/src/net/net.cpp
index 5dcbad577..237287fef 100644
--- a/src/net/net.cpp
+++ b/src/net/net.cpp
@@ -60,6 +60,7 @@ namespace Net
class QuestHandler;
class ServerFeatures;
class SkillHandler;
+ class TradeHandler;
}
Net::AdminHandler *adminHandler = nullptr;
@@ -86,12 +87,6 @@ Net::FamilyHandler *familyHandler = nullptr;
Net::BankHandler *bankHandler = nullptr;
Net::QuestHandler *questHandler = nullptr;
-Net::TradeHandler *Net::getTradeHandler()
-{
- return tradeHandler;
-}
-
-
namespace Net
{
ServerInfo::Type networkType = ServerInfo::UNKNOWN;
diff --git a/src/net/net.h b/src/net/net.h
index 4ec729cb3..12abe18a6 100644
--- a/src/net/net.h
+++ b/src/net/net.h
@@ -36,10 +36,6 @@
namespace Net
{
-class TradeHandler;
-
-TradeHandler *getTradeHandler() A_WARN_UNUSED;
-
ServerInfo::Type getNetworkType() A_WARN_UNUSED;
/**
diff --git a/src/net/tradehandler.h b/src/net/tradehandler.h
index 040d68179..737076e6a 100644
--- a/src/net/tradehandler.h
+++ b/src/net/tradehandler.h
@@ -68,4 +68,6 @@ class TradeHandler notfinal
} // namespace Net
+extern Net::TradeHandler *tradeHandler;
+
#endif // NET_TRADEHANDLER_H