From 744b6e62e1252ca50445b21f671ad8d81dd28ea1 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 27 Apr 2014 14:50:47 +0300 Subject: Add AttributeListener. --- src/gui/windows/inventorywindow.cpp | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'src/gui/windows/inventorywindow.cpp') 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(); +} -- cgit v1.2.3-70-g09d2