summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-11-11 21:29:51 +0300
committerAndrei Karas <akaras@inbox.ru>2015-11-11 21:30:42 +0300
commitc6997f8ee41d5f85dd8a1269e82982e1ab0b5c74 (patch)
treed34c46ef9d3cf927c6b3a0756cfa6d87283773a8 /src/gui/widgets
parent540ddb5411378d5e60c942cda230ddf186bdfbc6 (diff)
downloadplus-c6997f8ee41d5f85dd8a1269e82982e1ab0b5c74.tar.gz
plus-c6997f8ee41d5f85dd8a1269e82982e1ab0b5c74.tar.bz2
plus-c6997f8ee41d5f85dd8a1269e82982e1ab0b5c74.tar.xz
plus-c6997f8ee41d5f85dd8a1269e82982e1ab0b5c74.zip
In personal shops in sell dialog shop no existing items with amount 0 and disabled.
Only for legacy servers.
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/selldialog.cpp13
-rw-r--r--src/gui/widgets/selldialog.h11
-rw-r--r--src/gui/widgets/shoplistbox.cpp7
3 files changed, 17 insertions, 14 deletions
diff --git a/src/gui/widgets/selldialog.cpp b/src/gui/widgets/selldialog.cpp
index 3ad8e5e7e..76cea21f2 100644
--- a/src/gui/widgets/selldialog.cpp
+++ b/src/gui/widgets/selldialog.cpp
@@ -218,18 +218,19 @@ void SellDialog::addItem(const Item *const item, const int price)
mShopItemList->adjustSize();
}
-void SellDialog::addItem(const int id,
- const int type,
- const ItemColor color,
- const int amount,
- const int price)
+ShopItem *SellDialog::addItem(const int id,
+ const int type,
+ const ItemColor color,
+ const int amount,
+ const int price)
{
- mShopItems->addItem(id,
+ ShopItem *const item = mShopItems->addItem(id,
type,
color,
amount,
price);
mShopItemList->adjustSize();
+ return item;
}
diff --git a/src/gui/widgets/selldialog.h b/src/gui/widgets/selldialog.h
index 92008df38..e94619f1f 100644
--- a/src/gui/widgets/selldialog.h
+++ b/src/gui/widgets/selldialog.h
@@ -34,6 +34,7 @@ class Button;
class Item;
class Label;
class ScrollArea;
+class ShopItem;
class ShopItems;
class ShopListBox;
class Slider;
@@ -93,11 +94,11 @@ class SellDialog notfinal : public Window,
*/
void setVisible(Visible visible) override final;
- void addItem(const int id,
- const int type,
- const ItemColor color,
- const int amount,
- const int price);
+ ShopItem *addItem(const int id,
+ const int type,
+ const ItemColor color,
+ const int amount,
+ const int price);
/**
* Returns true if any instances exist.
diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp
index c8f1bd889..6cdf58d2e 100644
--- a/src/gui/widgets/shoplistbox.cpp
+++ b/src/gui/widgets/shoplistbox.cpp
@@ -106,9 +106,10 @@ void ShopListBox::draw(Graphics *graphics)
Color* backgroundColor = &mBackgroundColor;
ShopItem *const item = mShopItems->at(i);
- if (item && ((mShopItems && mPlayerMoney < item->getPrice()
- && mPriceCheck)
- || (mProtectItems && PlayerInfo::isItemProtected(item->getId()))))
+ if (item &&
+ (item->getDisabled() ||
+ (mShopItems && mPlayerMoney < item->getPrice() && mPriceCheck) ||
+ (mProtectItems && PlayerInfo::isItemProtected(item->getId()))))
{
if (i != mSelected)
{