diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-08-16 22:52:46 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-08-16 22:52:46 +0300 |
commit | fa68f4ad4b2f776af834f8209b51761f6c2ba125 (patch) | |
tree | e6ffa76bedd1ed8bae3b859814482d3cf6359183 /src | |
parent | 658a7a325114783627c7c6c870bfe01791f9f63e (diff) | |
download | plus-fa68f4ad4b2f776af834f8209b51761f6c2ba125.tar.gz plus-fa68f4ad4b2f776af834f8209b51761f6c2ba125.tar.bz2 plus-fa68f4ad4b2f776af834f8209b51761f6c2ba125.tar.xz plus-fa68f4ad4b2f776af834f8209b51761f6c2ba125.zip |
Show shop sign to other players only if shop is not empty.
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/shopwindow.cpp | 9 | ||||
-rw-r--r-- | src/gui/shopwindow.h | 2 | ||||
-rw-r--r-- | src/gui/widgets/shopitems.cpp | 5 | ||||
-rw-r--r-- | src/gui/widgets/shopitems.h | 2 | ||||
-rw-r--r-- | src/localplayer.cpp | 3 |
5 files changed, 20 insertions, 1 deletions
diff --git a/src/gui/shopwindow.cpp b/src/gui/shopwindow.cpp index 68ea57314..4311a04d2 100644 --- a/src/gui/shopwindow.cpp +++ b/src/gui/shopwindow.cpp @@ -803,3 +803,12 @@ int ShopWindow::sumAmount(Item *shopItem) } return sum; } + +bool ShopWindow::isShopEmpty() +{ + if (!mBuyShopItems || !mSellShopItems) + return true; + if (mBuyShopItems->empty() && mSellShopItems->empty()) + return true; + return false; +} diff --git a/src/gui/shopwindow.h b/src/gui/shopwindow.h index e07803225..e3fd9a5ca 100644 --- a/src/gui/shopwindow.h +++ b/src/gui/shopwindow.h @@ -133,6 +133,8 @@ class ShopWindow : public Window, public gcn::ActionListener, bool checkFloodCounter(int &counterTime); + bool isShopEmpty(); + private: void startTrade(); diff --git a/src/gui/widgets/shopitems.cpp b/src/gui/widgets/shopitems.cpp index c5bcd88c4..e15445b77 100644 --- a/src/gui/widgets/shopitems.cpp +++ b/src/gui/widgets/shopitems.cpp @@ -43,6 +43,11 @@ int ShopItems::getNumberOfElements() return static_cast<int>(mShopItems.size()); } +bool ShopItems::empty() +{ + return mShopItems.empty(); +} + std::string ShopItems::getElementAt(int i) { if (i < 0 || static_cast<unsigned>(i) >= mShopItems.size() diff --git a/src/gui/widgets/shopitems.h b/src/gui/widgets/shopitems.h index abfcffb71..29d24cb64 100644 --- a/src/gui/widgets/shopitems.h +++ b/src/gui/widgets/shopitems.h @@ -76,6 +76,8 @@ class ShopItems : public gcn::ListModel */ int getNumberOfElements(); + bool empty(); + /** * Returns the name of item number i in the shop. * diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 9f0a7c5f3..0dcf7e7c2 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -50,6 +50,7 @@ #include "gui/okdialog.h" #include "gui/outfitwindow.h" #include "gui/palette.h" +#include "gui/shopwindow.h" #include "gui/skilldialog.h" #include "gui/socialwindow.h" #include "gui/statuswindow.h" @@ -344,7 +345,7 @@ void LocalPlayer::logic() if (mEnableAdvert && !mBlockAdvert && mAdvertTime < cur_time) { Uint8 smile = FLAG_SPECIAL; - if (mTradebot) + if (mTradebot && shopWindow && !shopWindow->isShopEmpty()) smile += FLAG_SHOP; if (mAwayMode) |