diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/windows/buydialog.cpp | 14 | ||||
-rw-r--r-- | src/gui/windows/buydialog.h | 7 |
2 files changed, 14 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; diff --git a/src/gui/windows/buydialog.h b/src/gui/windows/buydialog.h index af63432f7..088e9c2ba 100644 --- a/src/gui/windows/buydialog.h +++ b/src/gui/windows/buydialog.h @@ -76,6 +76,13 @@ class BuyDialog final : public Window, */ ~BuyDialog(); + enum + { + Nick = -1, + Items = -2, + Market = -3 + }; + void init(); /** |