From 2f8ee95fbacb71e7cbca85fcc11e6f9f7e36c258 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Thu, 12 Jun 2008 09:06:01 +0000 Subject: Merged revisions 3738 via svnmerge from https://themanaworld.svn.sourceforge.net/svnroot/themanaworld/tmw/trunk ........ r3738 | b_lindeijer | 2007-11-16 00:44:01 +0100 (Fri, 16 Nov 2007) | 3 lines Moved item icon from ItemInfo class to the Item class, so that it can be loaded on demand. Results in faster startup time and reduced memory usage. ........ --- src/gui/itemshortcutcontainer.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/gui/itemshortcutcontainer.cpp') 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; -- cgit v1.2.3-70-g09d2