diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-05-28 00:18:59 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2005-05-28 00:18:59 +0000 |
commit | 4525bedabcf5796da0d7923a014bbdc18fee429e (patch) | |
tree | 81e2ac034886fffcb3b9d17699a57dbe87d37aa0 | |
parent | 30063f42cc8d13ed241a52b90e63c2c68599115e (diff) | |
download | mana-client-4525bedabcf5796da0d7923a014bbdc18fee429e.tar.gz mana-client-4525bedabcf5796da0d7923a014bbdc18fee429e.tar.bz2 mana-client-4525bedabcf5796da0d7923a014bbdc18fee429e.tar.xz mana-client-4525bedabcf5796da0d7923a014bbdc18fee429e.zip |
Applied inventory weight information patch by Javila.
-rw-r--r-- | src/game.cpp | 6 | ||||
-rw-r--r-- | src/gui/inventory.cpp | 17 | ||||
-rw-r--r-- | src/gui/inventory.h | 4 | ||||
-rw-r--r-- | src/main.h | 3 |
4 files changed, 26 insertions, 4 deletions
diff --git a/src/game.cpp b/src/game.cpp index 9193e821..f84775b7 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1041,6 +1041,12 @@ void do_parse() char_info->skill_point = RFIFOW(4); skillDialog->setPoints(char_info->skill_point); break; + case 0x0018: + char_info->totalWeight = RFIFOW(4); + break; + case 0x0019: + char_info->maxWeight = RFIFOW(4); + break; case 0x0037: char_info->job_lv = RFIFOW(4); break; diff --git a/src/gui/inventory.cpp b/src/gui/inventory.cpp index 95cc4bd3..66ccff58 100644 --- a/src/gui/inventory.cpp +++ b/src/gui/inventory.cpp @@ -36,7 +36,7 @@ InventoryWindow::InventoryWindow(): Window("Inventory") { - setContentSize(322, 150); + setContentSize(322, 160); useButton = new Button("Use"); dropButton = new Button("Drop"); @@ -51,12 +51,17 @@ InventoryWindow::InventoryWindow(): itemNameLabel = new gcn::Label("Name:"); itemDescriptionLabel = new gcn::Label("Description:"); + weightLabel = new gcn::Label("Total Weight: - Maximum Weight: "); + weightLabel->setPosition(8, 8); + invenScroll->setPosition(8, + weightLabel->getY() + weightLabel->getHeight() + 5); add(useButton); add(dropButton); add(invenScroll); add(itemNameLabel); add(itemDescriptionLabel); + add(weightLabel); setResizeable(true); setMinWidth(240); @@ -74,6 +79,7 @@ InventoryWindow::~InventoryWindow() delete items; delete itemNameLabel; delete itemDescriptionLabel; + delete weightLabel; } void InventoryWindow::logic() @@ -83,6 +89,13 @@ void InventoryWindow::logic() // It would be nicer if this update could be event based, needs some // redesign of InventoryWindow and ItemContainer probably. updateButtons(); + + // Update weight information + char tempstr[128]; + sprintf(tempstr, "Total Weight: %2i - Maximum Weight: %2i", + char_info->totalWeight, char_info->maxWeight); + weightLabel->setCaption(tempstr); + weightLabel->adjustSize(); } int InventoryWindow::addItem(int index, int id, int quantity, bool equipment) @@ -207,7 +220,7 @@ void InventoryWindow::updateWidgets() dropButton->setPosition(48 + 16, getHeight() - 24); items->setSize(getWidth() - 24 - 12 - 1, (INVENTORY_SIZE * 24) / (getWidth() / 24) - 1); - invenScroll->setSize(getWidth() - 16, getHeight() - 72); + invenScroll->setSize(getWidth() - 16, getHeight() - 90); itemNameLabel->setPosition(8, invenScroll->getY() + invenScroll->getHeight() + 4); itemDescriptionLabel->setPosition(8, diff --git a/src/gui/inventory.h b/src/gui/inventory.h index 37edff7f..969424fb 100644 --- a/src/gui/inventory.h +++ b/src/gui/inventory.h @@ -51,7 +51,7 @@ class InventoryWindow : public Window, gcn::ActionListener ~InventoryWindow(); /** - * Logic (updates buttons) + * Logic (updates buttons and weight information) */ void logic(); @@ -93,6 +93,7 @@ class InventoryWindow : public Window, gcn::ActionListener int dropItem(int index, int quantity); void mouseClick(int x, int y, int button, int count); + void mouseMotion(int mx, int my); ItemContainer *items; @@ -107,6 +108,7 @@ class InventoryWindow : public Window, gcn::ActionListener gcn::Label *itemNameLabel; gcn::Label *itemDescriptionLabel; + gcn::Label *weightLabel; }; #endif @@ -82,7 +82,8 @@ typedef struct { short statp, skill_point, hair_color, hair_style; char STR, AGI, VIT, INT, DEX, LUK; char STRUp, AGIUp, VITUp, INTUp, DEXUp, LUKUp; - short weapon; + int totalWeight, maxWeight; + short weapon; // skill list declaration std::vector<SKILL> m_Skill; // array of N_SKILLS skills // gets the requested skills level from char_info |