summaryrefslogtreecommitdiff
path: root/src/gui/itemshortcutcontainer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/itemshortcutcontainer.cpp')
-rw-r--r--src/gui/itemshortcutcontainer.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/gui/itemshortcutcontainer.cpp b/src/gui/itemshortcutcontainer.cpp
index b15c8983..0ce4f6b7 100644
--- a/src/gui/itemshortcutcontainer.cpp
+++ b/src/gui/itemshortcutcontainer.cpp
@@ -25,6 +25,7 @@
#include "../localplayer.h"
#include "../graphics.h"
+#include "../inventory.h"
#include "../item.h"
#include "../itemshortcut.h"
#include "../keyboardconfig.h"
@@ -93,10 +94,11 @@ ItemShortcutContainer::draw(gcn::Graphics *graphics)
if (itemShortcut->getItem(i) < 0)
continue;
- Item *item = player_node->searchForItem(itemShortcut->getItem(i));
+ Item *item =
+ player_node->getInventory()->findItem(itemShortcut->getItem(i));
if (item) {
// Draw item icon.
- Image* image = item->getInfo().getImage();
+ Image* image = item->getImage();
if (image) {
g->drawImage(image, itemX, itemY);
g->drawText(
@@ -110,7 +112,7 @@ ItemShortcutContainer::draw(gcn::Graphics *graphics)
if (mItemMoved)
{
// Draw the item image being dragged by the cursor.
- Image* image = mItemMoved->getInfo().getImage();
+ Image* image = mItemMoved->getImage();
if (image)
{
const int tPosX = mCursorPosX - (image->getWidth() / 2);
@@ -151,9 +153,10 @@ ItemShortcutContainer::mouseDragged(gcn::MouseEvent &event)
if (index == -1) {
return;
}
- if (itemShortcut->getItem(index) < 0)
+ const int itemId = itemShortcut->getItem(index);
+ if (itemId < 0)
return;
- Item *item = player_node->searchForItem(itemShortcut->getItem(index));
+ Item *item = player_node->getInventory()->findItem(itemId);
if (item)
{
mItemMoved = item;