From 00dcbde760c522405ba94fbff747c7d8e083c811 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 20 Jul 2013 13:03:01 +0300 Subject: Some bugfix in item creation logic. not show items with id < 500. --- src/commands.cpp | 2 +- src/gui/buydialog.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/commands.cpp b/src/commands.cpp index e0bb195d0..cf1e049f6 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -1209,7 +1209,7 @@ impHandler0(createItems) { const ItemInfo *const info = (*it).second; const int id = info->getId(); - if (id <= 0) + if (id <= 500) continue; const int colors = info->getColorsSize(); diff --git a/src/gui/buydialog.cpp b/src/gui/buydialog.cpp index 6c9cc0bd7..03d101c87 100644 --- a/src/gui/buydialog.cpp +++ b/src/gui/buydialog.cpp @@ -194,7 +194,7 @@ BuyDialog::BuyDialog() : Window(_("Create items"), false, nullptr, "buy.xml"), gcn::ActionListener(), gcn::SelectionListener(), - mNpcId(0), mMoney(0), mAmountItems(0), mMaxItems(0), mNick(), + mNpcId(-2), mMoney(0), mAmountItems(0), mMaxItems(0), mNick(), mSortModel(nullptr), mSortDropDown(nullptr) { @@ -267,7 +267,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 == 0 + mBuyButton = new Button(this, mNpcId == -2 ? _("Create") :_("Buy"), "buy", this); // TRANSLATORS: buy dialog button mQuitButton = new Button(this, _("Quit"), "quit", this); @@ -433,7 +433,7 @@ void BuyDialog::action(const gcn::ActionEvent &event) } else if (eventId == "buy" && mAmountItems > 0 && mAmountItems <= mMaxItems) { - if (!mNpcId) + if (mNpcId == -2) { const ShopItem *const item = mShopItems->at(selectedItem); Net::getAdminHandler()->createItems(item->getId(), @@ -498,7 +498,7 @@ void BuyDialog::updateButtonsAndLabels() const int itemPrice = item->getPrice(); // Calculate how many the player can afford - if (!mNpcId) + if (mNpcId == -2) mMaxItems = 100; else if (itemPrice) mMaxItems = mMoney / itemPrice; -- cgit v1.2.3-60-g2f50