diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-02-27 16:26:21 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-02-27 16:26:21 +0300 |
commit | 32947c0634ec582f6d641402433d2037f5087a36 (patch) | |
tree | 776923ebcb5f52f663a622bac8b578d20833c511 /src | |
parent | 8b1e42a9e0d311d9c393ebceef1d508cbc8ad324 (diff) | |
download | manaplus-32947c0634ec582f6d641402433d2037f5087a36.tar.gz manaplus-32947c0634ec582f6d641402433d2037f5087a36.tar.bz2 manaplus-32947c0634ec582f6d641402433d2037f5087a36.tar.xz manaplus-32947c0634ec582f6d641402433d2037f5087a36.zip |
Fix compilation with eathena only.
Diffstat (limited to 'src')
-rw-r--r-- | src/game.cpp | 2 | ||||
-rw-r--r-- | src/gui/windows/shopwindow.cpp | 72 | ||||
-rw-r--r-- | src/gui/windows/shopwindow.h | 19 | ||||
-rw-r--r-- | src/net/ea/buysellhandler.cpp | 7 |
4 files changed, 57 insertions, 43 deletions
diff --git a/src/game.cpp b/src/game.cpp index 204732a15..a44c793c8 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -628,8 +628,10 @@ void Game::slowLogic() } } +#ifdef TMWA_SUPPORT if (shopWindow) shopWindow->updateTimes(); +#endif if (mainGraphics->getOpenGL()) DelayedManager::delayedLoad(); #ifdef TMWA_SUPPORT 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) { diff --git a/src/gui/windows/shopwindow.h b/src/gui/windows/shopwindow.h index cff596f5c..09b7da951 100644 --- a/src/gui/windows/shopwindow.h +++ b/src/gui/windows/shopwindow.h @@ -118,16 +118,17 @@ class ShopWindow final : public Window, void saveList() const; - void announce(ShopItems *const list, const int mode); - - void giveList(const std::string &nick, const int mode); - +#ifdef TMWA_SUPPORT void setAcceptPlayer(const std::string &name) { mAcceptPlayer = name; } const std::string &getAcceptPlayer() const A_WARN_UNUSED { return mAcceptPlayer; } + void announce(ShopItems *const list, const int mode); + + void giveList(const std::string &nick, const int mode); + void sendMessage(const std::string &nick, std::string data, const bool random = false); @@ -135,16 +136,16 @@ class ShopWindow final : public Window, void processRequest(const std::string &nick, std::string data, const int mode); + void updateTimes(); + + static bool checkFloodCounter(int &counterTime) A_WARN_UNUSED; bool findShopItem(const ShopItem *const shopItem, const int mode) const A_WARN_UNUSED; +#endif static int sumAmount(const Item *const shopItem) A_WARN_UNUSED; - void updateTimes(); - - static bool checkFloodCounter(int &counterTime) A_WARN_UNUSED; - bool isShopEmpty() const A_WARN_UNUSED; #ifdef EATHENA_SUPPORT @@ -160,7 +161,9 @@ class ShopWindow final : public Window, #endif private: +#ifdef TMWA_SUPPORT void startTrade(); +#endif void updateSelection(); diff --git a/src/net/ea/buysellhandler.cpp b/src/net/ea/buysellhandler.cpp index 537a741ea..7d33492ce 100644 --- a/src/net/ea/buysellhandler.cpp +++ b/src/net/ea/buysellhandler.cpp @@ -65,8 +65,10 @@ void BuySellHandler::requestSellList(const std::string &nick) const return; const std::string data("!selllist " + toString(tick_time)); +// +++ need move to tmwa +#ifdef TMWA_SUPPORT shopWindow->setAcceptPlayer(nick); - +#endif if (config.getBoolValue("hideShopMessages")) { chatHandler->privateMessage(nick, data); @@ -84,7 +86,10 @@ void BuySellHandler::requestBuyList(const std::string &nick) const return; const std::string data("!buylist " + toString(tick_time)); +// +++ need move to tmwa +#ifdef TMWA_SUPPORT shopWindow->setAcceptPlayer(nick); +#endif if (config.getBoolValue("hideShopMessages")) { |