diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-04-27 14:50:47 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-04-27 14:50:47 +0300 |
commit | 744b6e62e1252ca50445b21f671ad8d81dd28ea1 (patch) | |
tree | 79adc9663a740ed471e33c97932ce6b28de11377 /src/gui/windows/inventorywindow.cpp | |
parent | 2ee2f8b060e4fe88feeeba5508189c916e55a70d (diff) | |
download | plus-744b6e62e1252ca50445b21f671ad8d81dd28ea1.tar.gz plus-744b6e62e1252ca50445b21f671ad8d81dd28ea1.tar.bz2 plus-744b6e62e1252ca50445b21f671ad8d81dd28ea1.tar.xz plus-744b6e62e1252ca50445b21f671ad8d81dd28ea1.zip |
Add AttributeListener.
Diffstat (limited to 'src/gui/windows/inventorywindow.cpp')
-rw-r--r-- | src/gui/windows/inventorywindow.cpp | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index 01e5e052d..2122fce2f 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -73,6 +73,7 @@ InventoryWindow::InventoryWindow(Inventory *const inventory): KeyListener(), SelectionListener(), InventoryListener(), + AttributeListener(), mInventory(inventory), mItems(new ItemContainer(this, mInventory)), mUseButton(nullptr), @@ -131,8 +132,6 @@ InventoryWindow::InventoryWindow(Inventory *const inventory): mSortDropDown->setSelected(0); } - listen(CHANNEL_ATTRIBUTES); - if (setupWindow) setupWindow->registerWindowForReset(this); @@ -690,17 +689,6 @@ void InventoryWindow::close() } } -void InventoryWindow::processEvent(const Channels channel A_UNUSED, - const DepricatedEvent &event) -{ - if (event.getName() == EVENT_UPDATEATTRIBUTE) - { - const int id = event.getInt("id"); - if (id == PlayerInfo::TOTAL_WEIGHT || id == PlayerInfo::MAX_WEIGHT) - updateWeight(); - } -} - void InventoryWindow::updateWeight() { if (!isMainInventory() || !mWeightBar) @@ -821,3 +809,11 @@ void InventoryWindow::unsetInventory() } mInventory = nullptr; } + +void InventoryWindow::attributeChanged(const int id, + const int oldVal A_UNUSED, + const int newVal A_UNUSED) +{ + if (id == PlayerInfo::TOTAL_WEIGHT || id == PlayerInfo::MAX_WEIGHT) + updateWeight(); +} |