summaryrefslogtreecommitdiff
path: root/src/itemshortcut.h
diff options
context:
space:
mode:
authorDennis Friis <peavey@placid.dk>2008-04-24 20:49:30 +0000
committerDennis Friis <peavey@placid.dk>2008-04-24 20:49:30 +0000
commit3676b78c6e6e8089c0b6e38c0983bd99ea22e756 (patch)
tree30dadd8b4e00f70245279eeee04c71347f7dbc60 /src/itemshortcut.h
parent8c0964dbb59a10c47d2040686b03201ab5688092 (diff)
downloadMana-3676b78c6e6e8089c0b6e38c0983bd99ea22e756.tar.gz
Mana-3676b78c6e6e8089c0b6e38c0983bd99ea22e756.tar.bz2
Mana-3676b78c6e6e8089c0b6e38c0983bd99ea22e756.tar.xz
Mana-3676b78c6e6e8089c0b6e38c0983bd99ea22e756.zip
Make shortcut container ID based instead of slot based. Fixes items shifting around often causing equipment to be lost.
Diffstat (limited to 'src/itemshortcut.h')
-rw-r--r--src/itemshortcut.h32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/itemshortcut.h b/src/itemshortcut.h
index fecb7d86..d75db2e8 100644
--- a/src/itemshortcut.h
+++ b/src/itemshortcut.h
@@ -50,11 +50,11 @@ class ItemShortcut
void load();
/**
- * Returns the shortcut item specified by the index.
+ * Returns the shortcut item ID specified by the index.
*
* @param index Index of the shortcut item.
*/
- Item* getItem(int index) const
+ int getItem(int index) const
{ return mItems[index]; }
/**
@@ -64,13 +64,13 @@ class ItemShortcut
{ return SHORTCUT_ITEMS; }
/**
- * Returns the item that is currently selected.
+ * Returns the item ID that is currently selected.
*/
- Item* getItemSelected() const
+ int getItemSelected() const
{ return mItemSelected; }
/**
- * Adds the selected item to the items specified by the index.
+ * Adds the selected item ID to the items specified by the index.
*
* @param index Index of the items.
*/
@@ -80,31 +80,31 @@ class ItemShortcut
/**
* Adds an item to the items store specified by the index.
*
- * @param index Index of the items.
- * @param item Item to store.
+ * @param index Index of the item.
+ * @param itemId ID of the item.
*/
- void setItems(int index, Item *item)
- { mItems[index] = item; }
+ void setItems(int index, int itemId)
+ { mItems[index] = itemId; }
/**
* Set the item that is selected.
*
- * @param item The item that is to be assigned.
+ * @param itemId The ID of the item that is to be assigned.
*/
- void setItemSelected(Item* item)
- { mItemSelected = item; }
+ void setItemSelected(int itemId)
+ { mItemSelected = itemId; }
/**
* A flag to check if the item is selected.
*/
bool isItemSelected()
- { return mItemSelected; }
+ { return mItemSelected > -1; }
/**
* Remove a item from the shortcut.
*/
void removeItem(int index)
- { mItems[index] = 0; }
+ { mItems[index] = -1; }
/**
* Try to use the item specified by the index.
@@ -119,8 +119,8 @@ class ItemShortcut
*/
void save();
- Item* mItems[SHORTCUT_ITEMS]; /**< The items stored. */
- Item* mItemSelected; /**< The item held by cursor. */
+ int mItems[SHORTCUT_ITEMS]; /**< The items stored. */
+ int mItemSelected; /**< The item held by cursor. */
};