summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-07-20 13:03:01 +0300
committerAndrei Karas <akaras@inbox.ru>2013-07-20 13:03:01 +0300
commit00dcbde760c522405ba94fbff747c7d8e083c811 (patch)
treedcc73ffb75d94e5569ec11aca3d7923240d9817e
parent2008152818c796daf526a874d18a7e77c87d423c (diff)
downloadmanaplus-00dcbde760c522405ba94fbff747c7d8e083c811.tar.gz
manaplus-00dcbde760c522405ba94fbff747c7d8e083c811.tar.bz2
manaplus-00dcbde760c522405ba94fbff747c7d8e083c811.tar.xz
manaplus-00dcbde760c522405ba94fbff747c7d8e083c811.zip
Some bugfix in item creation logic.
not show items with id < 500.
-rw-r--r--src/commands.cpp2
-rw-r--r--src/gui/buydialog.cpp8
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;