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/itemcontainer.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/itemcontainer.cpp')
-rw-r--r-- | src/gui/itemcontainer.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp index eb8b91a7..cf5dcb92 100644 --- a/src/gui/itemcontainer.cpp +++ b/src/gui/itemcontainer.cpp @@ -101,9 +101,8 @@ ItemContainer::draw(gcn::Graphics *graphics) { Item *item = mInventory->getItem(i); - if (item->getQuantity() <= 0) { + if (!item || item->getQuantity() <= 0) continue; - } int itemX = ((i - 2) % columns) * gridWidth; int itemY = ((i - 2) / columns) * gridHeight; @@ -116,8 +115,8 @@ ItemContainer::draw(gcn::Graphics *graphics) } // Draw item icon - Image* image; - if ((image = item->getInfo().getImage()) != NULL) + Image* image = item->getImage(); + if (image) { static_cast<Graphics*>(graphics)->drawImage( image, itemX, itemY); @@ -151,7 +150,7 @@ void ItemContainer::recalculateHeight() } Item* -ItemContainer::getItem() +ItemContainer::getSelectedItem() const { return mSelectedItem; } @@ -206,7 +205,7 @@ ItemContainer::mousePressed(gcn::MouseEvent &event) } Item *item = mInventory->getItem(index); setSelectedItem(item); - if (!item->isEquipment()) + if (item && !item->isEquipment()) { itemShortcut->setItemSelected(item->getId()); } |