diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/being/being.cpp | 2 | ||||
-rw-r--r-- | src/enums/gui/shoplistboxtype.h | 34 | ||||
-rw-r--r-- | src/gui/widgets/selldialog.cpp | 3 | ||||
-rw-r--r-- | src/gui/widgets/shoplistbox.cpp | 8 | ||||
-rw-r--r-- | src/gui/widgets/shoplistbox.h | 15 | ||||
-rw-r--r-- | src/gui/windows/buydialog.cpp | 3 | ||||
-rw-r--r-- | src/gui/windows/shopwindow.cpp | 4 |
9 files changed, 63 insertions, 8 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d04f82b52..a84b11396 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1324,6 +1324,7 @@ SET(SRCS enums/gui/itemamountwindowusage.h enums/gui/progresscolorid.h enums/gui/serverdialogdonwloadstatus.h + enums/gui/shoplistboxtype.h enums/gui/themecolorid.h enums/gui/updatedownloadstatus.h enums/gui/usercolorid.h diff --git a/src/Makefile.am b/src/Makefile.am index b88c41eb7..cebc5c3dc 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -128,6 +128,7 @@ SRC += events/actionevent.h \ enums/gui/itemamountwindowusage.h \ enums/gui/progresscolorid.h \ enums/gui/serverdialogdonwloadstatus.h \ + enums/gui/shoplistboxtype.h \ enums/gui/themecolorid.h \ enums/gui/updatedownloadstatus.h \ enums/gui/usercolorid.h \ diff --git a/src/being/being.cpp b/src/being/being.cpp index 398d82f48..11deec011 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -4835,6 +4835,8 @@ void Being::setTileCoords(const int x, const int y) restrict2 void Being::setMap(Map *restrict const map) restrict2 { + mCastEndTime = 0; + delete2(mCastingEffect); ActorSprite::setMap(map); if (mMap) { diff --git a/src/enums/gui/shoplistboxtype.h b/src/enums/gui/shoplistboxtype.h new file mode 100644 index 000000000..6f0cb8090 --- /dev/null +++ b/src/enums/gui/shoplistboxtype.h @@ -0,0 +1,34 @@ +/* + * The ManaPlus Client + * Copyright (C) 2011-2016 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef ENUMS_GUI_SHOPLISTBOXTYPE_H +#define ENUMS_GUI_SHOPLISTBOXTYPE_H + +#include "enums/simpletypes/enumdefines.h" + +enumStart(ShopListBoxType) +{ + Unknown = 0, + BuyShop = 1, + SellShop = 2 +} +enumEnd(ShopListBoxType); + +#endif // ENUMS_GUI_SHOPLISTBOXTYPE_H diff --git a/src/gui/widgets/selldialog.cpp b/src/gui/widgets/selldialog.cpp index c0b7fdd24..dbeab87ca 100644 --- a/src/gui/widgets/selldialog.cpp +++ b/src/gui/widgets/selldialog.cpp @@ -96,7 +96,8 @@ void SellDialog::postInit() mShopItemList = CREATEWIDGETR(ShopListBox, this, mShopItems, - mShopItems); + mShopItems, + ShopListBoxType::Unknown); mShopItemList->setProtectItems(true); mScrollArea = new ScrollArea(this, mShopItemList, getOptionBool("showbackground"), "sell_background.xml"); diff --git a/src/gui/widgets/shoplistbox.cpp b/src/gui/widgets/shoplistbox.cpp index 5d083a30f..3ce06ba0d 100644 --- a/src/gui/widgets/shoplistbox.cpp +++ b/src/gui/widgets/shoplistbox.cpp @@ -46,12 +46,14 @@ const int ITEM_ICON_SIZE = 32; ShopListBox::ShopListBox(const Widget2 *const widget, - ListModel *const listModel) : + ListModel *const listModel, + const ShopListBoxTypeT type) : ListBox(widget, listModel, "shoplistbox.xml"), mPlayerMoney(0), mShopItems(nullptr), mBackgroundColor(getThemeColor(ThemeColorId::BACKGROUND)), mWarningColor(getThemeColor(ThemeColorId::SHOP_WARNING)), + mType(type), mPriceCheck(true), mProtectItems(false) { @@ -62,12 +64,14 @@ ShopListBox::ShopListBox(const Widget2 *const widget, ShopListBox::ShopListBox(const Widget2 *const widget, ListModel *const listModel, - ShopItems *const shopListModel) : + ShopItems *const shopListModel, + const ShopListBoxTypeT type) : ListBox(widget, listModel, "shoplistbox.xml"), mPlayerMoney(0), mShopItems(shopListModel), mBackgroundColor(getThemeColor(ThemeColorId::BACKGROUND)), mWarningColor(getThemeColor(ThemeColorId::SHOP_WARNING)), + mType(type), mPriceCheck(true), mProtectItems(false) { diff --git a/src/gui/widgets/shoplistbox.h b/src/gui/widgets/shoplistbox.h index cc4504c82..471f6eadc 100644 --- a/src/gui/widgets/shoplistbox.h +++ b/src/gui/widgets/shoplistbox.h @@ -25,6 +25,8 @@ #include "gui/widgets/listbox.h" +#include "enums/gui/shoplistboxtype.h" + class ShopItems; /** @@ -41,14 +43,16 @@ class ShopListBox final : public ListBox * Constructor. */ ShopListBox(const Widget2 *const widget, - ListModel *const listModel); + ListModel *const listModel, + const ShopListBoxTypeT type); /** * Constructor with shopitems */ ShopListBox(const Widget2 *const widget, ListModel *const listModel, - ShopItems *const shopListModel); + ShopItems *const shopListModel, + const ShopListBoxTypeT type); A_DELETE_COPY(ShopListBox) @@ -84,6 +88,12 @@ class ShopListBox final : public ListBox void setProtectItems(bool p) { mProtectItems = p; } + void setType(const ShopListBoxTypeT type) + { mType = type; } + + ShopListBoxType getType() const + { return mType; } + private: int mPlayerMoney; @@ -95,6 +105,7 @@ class ShopListBox final : public ListBox Color mBackgroundColor; Color mWarningColor; + ShopListBoxTypeT mType; bool mPriceCheck; bool mProtectItems; diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp index 7ae527e63..f2e5cc46d 100644 --- a/src/gui/windows/buydialog.cpp +++ b/src/gui/windows/buydialog.cpp @@ -274,7 +274,8 @@ void BuyDialog::init() mShopItems = new ShopItems; - CREATEWIDGETV(mShopItemList, ShopListBox, this, mShopItems, mShopItems); + CREATEWIDGETV(mShopItemList, ShopListBox, this, + mShopItems, mShopItems, ShopListBoxType::Unknown); mScrollArea = new ScrollArea(this, mShopItemList, getOptionBool("showbackground"), "buy_background.xml"); mScrollArea->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); diff --git a/src/gui/windows/shopwindow.cpp b/src/gui/windows/shopwindow.cpp index e98d9ce1a..a2793640c 100644 --- a/src/gui/windows/shopwindow.cpp +++ b/src/gui/windows/shopwindow.cpp @@ -108,9 +108,9 @@ ShopWindow::ShopWindow() : mSellShopItems(new ShopItems), mTradeItem(nullptr), mBuyShopItemList(CREATEWIDGETR(ShopListBox, - this, mBuyShopItems, mBuyShopItems)), + this, mBuyShopItems, mBuyShopItems, ShopListBoxType::BuyShop)), mSellShopItemList(CREATEWIDGETR(ShopListBox, - this, mSellShopItems, mSellShopItems)), + this, mSellShopItems, mSellShopItems, ShopListBoxType::SellShop)), mCurrentShopItemList(nullptr), mScrollArea(new ScrollArea(this, mBuyShopItemList, getOptionBool("showbuybackground"), "shop_buy_background.xml")), |