diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2008-06-12 09:06:01 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2008-06-12 09:06:01 +0000 |
commit | 2f8ee95fbacb71e7cbca85fcc11e6f9f7e36c258 (patch) | |
tree | 8d256ac1a38932aaf0db7b55ed178e4212616555 /src/gui/itemshortcutcontainer.cpp | |
parent | eb019ab915998a3ec247b33dad4b23f763d7a29a (diff) | |
download | mana-client-2f8ee95fbacb71e7cbca85fcc11e6f9f7e36c258.tar.gz mana-client-2f8ee95fbacb71e7cbca85fcc11e6f9f7e36c258.tar.bz2 mana-client-2f8ee95fbacb71e7cbca85fcc11e6f9f7e36c258.tar.xz mana-client-2f8ee95fbacb71e7cbca85fcc11e6f9f7e36c258.zip |
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.
........
Diffstat (limited to 'src/gui/itemshortcutcontainer.cpp')
-rw-r--r-- | src/gui/itemshortcutcontainer.cpp | 13 |
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; |