From 53ee2ec3a7efd6ff62bff3abdb87eccec6fbe5c9 Mon Sep 17 00:00:00 2001 From: Fate Date: Fri, 28 Nov 2008 22:45:22 -0700 Subject: Remember last equipped item ID so that we jump to/re-find an item of the same ID whenever we lose the current one --- src/gui/itemcontainer.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/gui/itemcontainer.h') diff --git a/src/gui/itemcontainer.h b/src/gui/itemcontainer.h index fd77fea2..34545df8 100644 --- a/src/gui/itemcontainer.h +++ b/src/gui/itemcontainer.h @@ -78,7 +78,7 @@ class ItemContainer : public gcn::Widget, public gcn::MouseListener, /** * Returns the selected item. */ - Item* getSelectedItem() const; + Item* getSelectedItem(); /** * Sets selected item to NULL. @@ -109,19 +109,25 @@ class ItemContainer : public gcn::Widget, public gcn::MouseListener, */ void setSelectedItemIndex(int index); + /** + * Find the current item index by the most recently used item ID + */ + void refindSelectedItem(void); + /** * Determine and set the height of the container. */ - void recalculateHeight(); + void recalculateHeight(void); /** * Sends out selection events to the list of selection listeners. */ - void distributeValueChangedEvent(); + void distributeValueChangedEvent(void); Inventory *mInventory; Image *mSelImg; int mSelectedItemIndex; + int mLastSelectedItemId; // last selected item ID. If we lose the item, find again by ID. int mMaxItems; -- cgit v1.2.3-70-g09d2