summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gui/selldialog.cpp1
-rw-r--r--src/gui/widgets/shoplistbox.cpp13
-rw-r--r--src/gui/widgets/shoplistbox.h8
3 files changed, 15 insertions, 7 deletions
diff --git a/src/gui/selldialog.cpp b/src/gui/selldialog.cpp
index 2b397b331..f57db6dbd 100644
--- a/src/gui/selldialog.cpp
+++ b/src/gui/selldialog.cpp
@@ -83,6 +83,7 @@ void SellDialog::init()
mShopItems = new ShopItems(true);
mShopItemList = new ShopListBox(this, mShopItems, mShopItems);
+ mShopItemList->setProtectItems(true);
mScrollArea = new ScrollArea(mShopItemList,
getOptionBool("showbackground"), "sell_background.xml");
mScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp
index e6cbdae4e..b0f58bd5f 100644
--- a/src/gui/widgets/shoplistbox.cpp
+++ b/src/gui/widgets/shoplistbox.cpp
@@ -50,10 +50,11 @@ ShopListBox::ShopListBox(const Widget2 *const widget,
mShopItems(nullptr),
mItemPopup(new ItemPopup),
mRowHeight(getFont()->getHeight()),
- mPriceCheck(true),
mHighlightColor(getThemeColor(Theme::HIGHLIGHT)),
mBackgroundColor(getThemeColor(Theme::BACKGROUND)),
- mWarningColor(getThemeColor(Theme::SHOP_WARNING))
+ mWarningColor(getThemeColor(Theme::SHOP_WARNING)),
+ mPriceCheck(true),
+ mProtectItems(false)
{
mForegroundColor = getThemeColor(Theme::LISTBOX);
}
@@ -66,10 +67,11 @@ ShopListBox::ShopListBox(const Widget2 *const widget,
mShopItems(shopListModel),
mItemPopup(new ItemPopup),
mRowHeight(std::max(getFont()->getHeight(), ITEM_ICON_SIZE)),
- mPriceCheck(true),
mHighlightColor(getThemeColor(Theme::HIGHLIGHT)),
mBackgroundColor(getThemeColor(Theme::BACKGROUND)),
- mWarningColor(getThemeColor(Theme::SHOP_WARNING))
+ mWarningColor(getThemeColor(Theme::SHOP_WARNING)),
+ mPriceCheck(true),
+ mProtectItems(false)
{
mForegroundColor = getThemeColor(Theme::LISTBOX);
}
@@ -109,7 +111,8 @@ void ShopListBox::draw(gcn::Graphics *gcnGraphics)
ShopItem *const item = mShopItems->at(i);
if (item && ((mShopItems && mPlayerMoney < item->getPrice()
- && mPriceCheck) || PlayerInfo::isItemProtected(item->getId())))
+ && mPriceCheck)
+ || (mProtectItems && PlayerInfo::isItemProtected(item->getId()))))
{
if (i != mSelected)
{
diff --git a/src/gui/widgets/shoplistbox.h b/src/gui/widgets/shoplistbox.h
index 3f2cc6a27..8c0b6de45 100644
--- a/src/gui/widgets/shoplistbox.h
+++ b/src/gui/widgets/shoplistbox.h
@@ -84,6 +84,9 @@ class ShopListBox final : public ListBox
void mouseExited(gcn::MouseEvent& mouseEvent) override;
+ void setProtectItems(bool p)
+ { mProtectItems = p; }
+
private:
int mPlayerMoney;
@@ -97,12 +100,13 @@ class ShopListBox final : public ListBox
unsigned int mRowHeight; /**< Row Height */
- bool mPriceCheck;
-
gcn::Color mHighlightColor;
gcn::Color mBackgroundColor;
gcn::Color mWarningColor;
+ bool mPriceCheck;
+ bool mProtectItems;
+
static float mAlpha;
};