summaryrefslogtreecommitdiff
path: root/src/gui/windows/shopwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/windows/shopwindow.cpp')
-rw-r--r--src/gui/windows/shopwindow.cpp72
1 files changed, 38 insertions, 34 deletions
diff --git a/src/gui/windows/shopwindow.cpp b/src/gui/windows/shopwindow.cpp
index e10197537..4cb922519 100644
--- a/src/gui/windows/shopwindow.cpp
+++ b/src/gui/windows/shopwindow.cpp
@@ -231,6 +231,7 @@ void ShopWindow::action(const ActionEvent &event)
close();
return;
}
+#ifdef TMWA_SUPPORT
else if (eventId == "yes")
{
startTrade();
@@ -244,6 +245,19 @@ void ShopWindow::action(const ActionEvent &event)
player_relations.ignoreTrade(mTradeNick);
mTradeNick.clear();
}
+ else if (eventId == "announce")
+ {
+ if (isBuySelected)
+ {
+ if (mBuyShopItems && mBuyShopItems->getNumberOfElements() > 0)
+ announce(mBuyShopItems, BUY);
+ }
+ else if (mSellShopItems && mSellShopItems->getNumberOfElements() > 0)
+ {
+ announce(mSellShopItems, SELL);
+ }
+ }
+#endif
else if (eventId == "delete")
{
if (isBuySelected)
@@ -263,18 +277,6 @@ void ShopWindow::action(const ActionEvent &event)
localPlayer->updateStatus();
}
}
- else if (eventId == "announce")
- {
- if (isBuySelected)
- {
- if (mBuyShopItems && mBuyShopItems->getNumberOfElements() > 0)
- announce(mBuyShopItems, BUY);
- }
- else if (mSellShopItems && mSellShopItems->getNumberOfElements() > 0)
- {
- announce(mSellShopItems, SELL);
- }
- }
else if (eventId == "tab_buy")
{
isBuySelected = true;
@@ -387,28 +389,6 @@ void ShopWindow::action(const ActionEvent &event)
}
}
-void ShopWindow::startTrade()
-{
- if (!actorManager || !tradeWindow)
- return;
-
- const Being *const being = actorManager->findBeingByName(
- mTradeNick, ActorType::Player);
- tradeWindow->clear();
- if (mTradeMoney)
- {
- tradeWindow->addAutoMoney(mTradeNick, mTradeMoney);
- }
- else
- {
- tradeWindow->addAutoItem(mTradeNick, mTradeItem,
- mTradeItem->getQuantity());
- }
- tradeHandler->request(being);
- tradePartnerName = mTradeNick;
- mTradeNick.clear();
-}
-
void ShopWindow::valueChanged(const SelectionEvent &event A_UNUSED)
{
updateButtonsAndLabels();
@@ -629,6 +609,7 @@ void ShopWindow::saveList() const
shopFile.close();
}
+#ifdef TMWA_SUPPORT
void ShopWindow::announce(ShopItems *const list, const int mode)
{
if (!list)
@@ -688,6 +669,28 @@ void ShopWindow::announce(ShopItems *const list, const int mode)
chatHandler->channelMessage(TRADE_CHANNEL, data);
}
+void ShopWindow::startTrade()
+{
+ if (!actorManager || !tradeWindow)
+ return;
+
+ const Being *const being = actorManager->findBeingByName(
+ mTradeNick, ActorType::Player);
+ tradeWindow->clear();
+ if (mTradeMoney)
+ {
+ tradeWindow->addAutoMoney(mTradeNick, mTradeMoney);
+ }
+ else
+ {
+ tradeWindow->addAutoItem(mTradeNick, mTradeItem,
+ mTradeItem->getQuantity());
+ }
+ tradeHandler->request(being);
+ tradePartnerName = mTradeNick;
+ mTradeNick.clear();
+}
+
void ShopWindow::giveList(const std::string &nick, const int mode)
{
if (!checkFloodCounter(mLastRequestTimeList))
@@ -1001,6 +1004,7 @@ bool ShopWindow::findShopItem(const ShopItem *const shopItem,
}
return false;
}
+#endif
int ShopWindow::sumAmount(const Item *const shopItem)
{