summaryrefslogtreecommitdiff
path: root/src/gui/item_amount.cpp
diff options
context:
space:
mode:
authorJan-Fabian Humann <malastare@gmx.net>2005-05-12 18:34:52 +0000
committerJan-Fabian Humann <malastare@gmx.net>2005-05-12 18:34:52 +0000
commit308e722a1b3fc34ade98e88b050a024cbd2c9f78 (patch)
treeb7228180c846751ac44d792c415442f77acecdb6 /src/gui/item_amount.cpp
parentabe13c1a2b9338e9a3001128954cc9fb6125ce0f (diff)
downloadmana-308e722a1b3fc34ade98e88b050a024cbd2c9f78.tar.gz
mana-308e722a1b3fc34ade98e88b050a024cbd2c9f78.tar.bz2
mana-308e722a1b3fc34ade98e88b050a024cbd2c9f78.tar.xz
mana-308e722a1b3fc34ade98e88b050a024cbd2c9f78.zip
trade fixes as usual + quit dialog pops up now instead of being under other windows
Diffstat (limited to 'src/gui/item_amount.cpp')
-rw-r--r--src/gui/item_amount.cpp53
1 files changed, 26 insertions, 27 deletions
diff --git a/src/gui/item_amount.cpp b/src/gui/item_amount.cpp
index a63d5a8e..7f609a6c 100644
--- a/src/gui/item_amount.cpp
+++ b/src/gui/item_amount.cpp
@@ -80,9 +80,28 @@ ItemAmountWindow::~ItemAmountWindow() {
void ItemAmountWindow::resetAmount() {
amount = 1;
- itemAmountLabel->setCaption("1");
+ itemAmountLabel->setCaption("1");
}
+void ItemAmountWindow::setUsage(int usage) {
+ resetAmount();
+ switch (usage) {
+ case AMOUNT_TRADE_ADD:
+ setCaption("Select amount of items to trade.");
+ itemAmountOkButton->setEventId("AddTrade");
+ break;
+ case AMOUNT_ITEM_DROP:
+ setCaption("Select amount of items to drop.");
+ itemAmountOkButton->setEventId("Drop");
+ break;
+ default:
+
+ break;
+ }
+
+}
+
+
void ItemAmountWindow::action(const std::string& eventId) {
if (eventId == "Cancel")
{
@@ -93,6 +112,11 @@ void ItemAmountWindow::action(const std::string& eventId) {
inventoryWindow->dropItem(inventoryWindow->items->getIndex(), amount);
resetAmount();
setVisible(false);
+ } else if (eventId == "AddTrade")
+ {
+ tradeWindow->tradeItem(inventoryWindow->items->getIndex(), amount);
+ resetAmount();
+ setVisible(false);
} else if (eventId == "Plus")
{
if (amount < inventoryWindow->items->getQuantity())
@@ -108,35 +132,10 @@ void ItemAmountWindow::action(const std::string& eventId) {
if (amount > 1)
{
char tmpminus[128];
- amount = amount - 1;
+ amount--;
sprintf(tmpminus, "%i", amount);
itemAmountLabel->setCaption(tmpminus);
itemAmountLabel->adjustSize();
}
}
-
- /*WFIFOW(0) = net_w_value(0x00bb);
-
- if (eventId == "STR") {
- WFIFOW(2) = net_w_value(0x000d);
- }
- if (eventId == "AGI") {
- WFIFOW(2) = net_w_value(0x000e);
- }
- if (eventId == "VIT") {
- WFIFOW(2) = net_w_value(0x000f);
- }
- if (eventId == "INT") {
- WFIFOW(2) = net_w_value(0x0010);
- }
- if (eventId == "DEX") {
- WFIFOW(2) = net_w_value(0x0011);
- }
- if (eventId == "LUK") {
- WFIFOW(2) = net_w_value(0x0012);
- }
-
- flush();
- WFIFOW(4) = net_b_value(1);
- WFIFOSET(5); */
}