summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-08-13 20:40:16 +0000
committerGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-08-13 20:40:16 +0000
commitd3e938c478570be44c497607262fe8ca7145b171 (patch)
tree24f0e39e7f46d0ce17ba3f135137f8c7b024a2cf /src/gui
parent0bc585c7299ed1c9bccfaf0aa6b2cc7c4327d1ca (diff)
downloadmana-client-d3e938c478570be44c497607262fe8ca7145b171.tar.gz
mana-client-d3e938c478570be44c497607262fe8ca7145b171.tar.bz2
mana-client-d3e938c478570be44c497607262fe8ca7145b171.tar.xz
mana-client-d3e938c478570be44c497607262fe8ca7145b171.zip
Started conversion of buy/sell to new server.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/buy.cpp4
-rw-r--r--src/gui/buy.h2
-rw-r--r--src/gui/sell.cpp17
-rw-r--r--src/gui/sell.h2
-rw-r--r--src/gui/shop.cpp8
-rw-r--r--src/gui/shop.h2
6 files changed, 12 insertions, 23 deletions
diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp
index 2a8616f8..9ac37e96 100644
--- a/src/gui/buy.cpp
+++ b/src/gui/buy.cpp
@@ -128,9 +128,9 @@ void BuyDialog::reset()
updateButtonsAndLabels();
}
-void BuyDialog::addItem(short id, int price)
+void BuyDialog::addItem(int id, int amount, int price)
{
- mShopItems->addItem(id, price);
+ mShopItems->addItem(id, amount, price);
mShopItemList->adjustSize();
}
diff --git a/src/gui/buy.h b/src/gui/buy.h
index 7834a434..875deef9 100644
--- a/src/gui/buy.h
+++ b/src/gui/buy.h
@@ -68,7 +68,7 @@ class BuyDialog : public Window, public gcn::ActionListener, SelectionListener
/**
* Adds an item to the shop inventory.
*/
- void addItem(short id, int price);
+ void addItem(int id, int amount, int price);
/**
* Called when receiving actions from the widgets.
diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp
index 478371b1..53746248 100644
--- a/src/gui/sell.cpp
+++ b/src/gui/sell.cpp
@@ -126,22 +126,9 @@ void SellDialog::reset()
updateButtonsAndLabels();
}
-void SellDialog::addItem(Item *item, int price)
+void SellDialog::addItem(int item, int amount, int price)
{
- if (!item)
- return;
-
- ITEM_SHOP item_shop;
-
- item_shop.name = item->getInfo().getName()
- + " (" + toString(price) + " GP)";
- item_shop.price = price;
- item_shop.index = item->getInvIndex();
- item_shop.id = item->getId();
- item_shop.quantity = item->getQuantity();
- item_shop.image = item->getInfo().getImage();
-
- mShopItems->push_back(item_shop);
+ mShopItems->addItem(item, amount, price);
mShopItemList->adjustSize();
}
diff --git a/src/gui/sell.h b/src/gui/sell.h
index b8385a6f..fc42fd1c 100644
--- a/src/gui/sell.h
+++ b/src/gui/sell.h
@@ -63,7 +63,7 @@ class SellDialog : public Window, gcn::ActionListener, SelectionListener
/**
* Adds an item to the inventory.
*/
- void addItem(Item *item, int price);
+ void addItem(int item, int amount, int price);
/**
* Called when receiving actions from the widgets.
diff --git a/src/gui/shop.cpp b/src/gui/shop.cpp
index 3d972bc2..e2fd54f2 100644
--- a/src/gui/shop.cpp
+++ b/src/gui/shop.cpp
@@ -40,15 +40,17 @@ std::string ShopItems::getElementAt(int i)
return mItemsShop.at(i).name;
}
-void ShopItems::addItem(short id, int price)
+void ShopItems::addItem(int id, int amount, int price)
{
ITEM_SHOP item_shop;
+ ItemInfo const &item = ItemDB::get(id);
- item_shop.name = ItemDB::get(id).getName()
+ item_shop.name = item.getName()
+ " (" + toString(price) + " GP)";
item_shop.price = price;
item_shop.id = id;
- item_shop.image = ItemDB::get(id).getImage();
+ item_shop.quantity = amount;
+ item_shop.image = item.getImage();
mItemsShop.push_back(item_shop);
}
diff --git a/src/gui/shop.h b/src/gui/shop.h
index de452b5c..665e92cb 100644
--- a/src/gui/shop.h
+++ b/src/gui/shop.h
@@ -50,7 +50,7 @@ class ShopItems : public gcn::ListModel
/**
* Adds an item and its associated picture
*/
- void addItem(short id, int price);
+ void addItem(int id, int amount, int price);
/**
* Convenience function for adding items