diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-12-24 15:33:41 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-12-24 15:33:41 +0300 |
commit | 2f91a45e4c0c59a962059890ed5ab708a059788f (patch) | |
tree | cd156d8291ce9b56a635454a6292d9f3d98f737f /src/gui/windows/buydialog.cpp | |
parent | 1f7122e76f28ec851ef7d9361396575dde381287 (diff) | |
download | plus-2f91a45e4c0c59a962059890ed5ab708a059788f.tar.gz plus-2f91a45e4c0c59a962059890ed5ab708a059788f.tar.bz2 plus-2f91a45e4c0c59a962059890ed5ab708a059788f.tar.xz plus-2f91a45e4c0c59a962059890ed5ab708a059788f.zip |
Add enum for buy dialog types.
Diffstat (limited to 'src/gui/windows/buydialog.cpp')
-rw-r--r-- | src/gui/windows/buydialog.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp index ac3c9e588..33e3932bc 100644 --- a/src/gui/windows/buydialog.cpp +++ b/src/gui/windows/buydialog.cpp @@ -170,7 +170,7 @@ BuyDialog::BuyDialog() : SelectionListener(), mSortModel(nullptr), mSortDropDown(nullptr), - mNpcId(-2), + mNpcId(Items), mMoney(0), mAmountItems(0), mMaxItems(0), @@ -202,7 +202,7 @@ BuyDialog::BuyDialog(std::string nick) : SelectionListener(), mSortModel(new SortListModelBuy), mSortDropDown(new DropDown(this, mSortModel, false, false, this, "sort")), - mNpcId(-1), + mNpcId(Nick), mMoney(0), mAmountItems(0), mMaxItems(0), @@ -257,7 +257,7 @@ void BuyDialog::init() // You may change this symbol if your language uses another. mDecreaseButton = new Button(this, _("-"), "dec", this); // TRANSLATORS: buy dialog button - mBuyButton = new Button(this, mNpcId == -2 + mBuyButton = new Button(this, mNpcId == Items ? _("Create") :_("Buy"), "buy", this); // TRANSLATORS: buy dialog button mQuitButton = new Button(this, _("Quit"), "quit", this); @@ -435,14 +435,14 @@ void BuyDialog::action(const ActionEvent &event) else if (eventId == "buy" && mAmountItems > 0 && mAmountItems <= mMaxItems) { ShopItem *const item = mShopItems->at(selectedItem); - if (mNpcId == -2) + if (mNpcId == Items) { adminHandler->createItems(item->getId(), mAmountItems, item->getColor()); } - else if (mNpcId != -1) + else if (mNpcId != Nick) { - if (mNpcId != -3) + if (mNpcId != Market) { npcHandler->buyItem(mNpcId, item->getId(), @@ -508,7 +508,7 @@ void BuyDialog::updateButtonsAndLabels() const int itemPrice = item->getPrice(); // Calculate how many the player can afford - if (mNpcId == -2) + if (mNpcId == Items) mMaxItems = 100; else if (itemPrice) mMaxItems = mMoney / itemPrice; |