summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-04-02 17:02:01 +0200
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-04-02 17:04:04 +0200
commit722ea46c1e22fc8645477f6319c5099cb6066270 (patch)
tree45b4985aeb26f4a16b07a0b969decb2d2bbf3f01
parent0e864eefd0bae4fa861ce1b41a0707bb262665bd (diff)
downloadmana-client-722ea46c1e22fc8645477f6319c5099cb6066270.tar.gz
mana-client-722ea46c1e22fc8645477f6319c5099cb6066270.tar.bz2
mana-client-722ea46c1e22fc8645477f6319c5099cb6066270.tar.xz
mana-client-722ea46c1e22fc8645477f6319c5099cb6066270.zip
Fixed number of trade window slots
On eAthena you can only trade up to 10 items at a time. For now I don't care whether tmwserv would handle more, we'll unify that later. It's not so nice anyway to hardcode the number of rows and columns in my opinion.
-rw-r--r--src/gui/trade.cpp11
-rw-r--r--src/inventory.h18
2 files changed, 14 insertions, 15 deletions
diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp
index c94aad0a..fba5f600 100644
--- a/src/gui/trade.cpp
+++ b/src/gui/trade.cpp
@@ -61,12 +61,9 @@ TradeWindow::TradeWindow():
#endif
{
setWindowName("Trade");
- setResizable(true);
+ setResizable(false);
setCloseButton(true);
- setDefaultSize(342, 209, ImageRect::CENTER);
-
- setMinWidth(342);
- setMinHeight(209);
+ setDefaultSize(386, 180, ImageRect::CENTER);
std::string longestName = getFont()->getWidth(_("OK")) >
getFont()->getWidth(_("Trade")) ?
@@ -83,12 +80,12 @@ TradeWindow::TradeWindow():
mTradeButton->getFont()->getWidth(_("Propose trade")),
mTradeButton->getFont()->getWidth(_("Confirm trade"))));
- mMyItemContainer = new ItemContainer(mMyInventory.get(), 4, 3);
+ mMyItemContainer = new ItemContainer(mMyInventory.get(), 5, 2);
mMyItemContainer->addSelectionListener(this);
ScrollArea *myScroll = new ScrollArea(mMyItemContainer);
- mPartnerItemContainer = new ItemContainer(mPartnerInventory.get(), 4, 3);
+ mPartnerItemContainer = new ItemContainer(mPartnerInventory.get(), 5, 2);
mPartnerItemContainer->addSelectionListener(this);
ScrollArea *partnerScroll = new ScrollArea(mPartnerItemContainer);
diff --git a/src/inventory.h b/src/inventory.h
index 07a9276e..358c93e3 100644
--- a/src/inventory.h
+++ b/src/inventory.h
@@ -25,10 +25,10 @@
class Item;
#ifdef EATHENA_SUPPORT
-#define INVENTORY_SIZE 102
-#define STORAGE_SIZE 301
+const int INVENTORY_SIZE = 102;
+const int STORAGE_SIZE = 301;
#else
-#define INVENTORY_SIZE 50
+const int INVENTORY_SIZE = 50;
#endif
class Inventory
@@ -36,6 +36,8 @@ class Inventory
public:
/**
* Constructor.
+ *
+ * @param size the number of items that fit in the inventory
*/
Inventory(int size);
@@ -45,14 +47,14 @@ class Inventory
~Inventory();
/**
- * Returns the size that this instance is configured for
+ * Returns the size that this instance is configured for.
*/
- int getSize() { return mSize; }
+ int getSize() const { return mSize; }
/**
* Returns the item at the specified index.
*/
- Item* getItem(int index) const;
+ Item *getItem(int index) const;
/**
* Searches for the specified item by it's id.
@@ -60,7 +62,7 @@ class Inventory
* @param itemId The id of the item to be searched.
* @return Item found on success, NULL on failure.
*/
- Item* findItem(int itemId) const;
+ Item *findItem(int itemId) const;
/**
* Adds a new item in a free slot.
@@ -83,7 +85,7 @@ class Inventory
void removeItemAt(int index);
/**
- * Checks if the given item is in the inventory
+ * Checks if the given item is in the inventory.
*/
bool contains(Item *item) const;