diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-10-15 07:22:29 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-10-15 07:22:29 -0600 |
commit | 59657fcbfa88a8f7a15bf4350f8addf399e20bda (patch) | |
tree | e5a9a856dc80bd55427380383a5953b75c874b4a /src | |
parent | 2f55dd130c886376a45c9d0054dbd987cc055155 (diff) | |
download | mana-client-59657fcbfa88a8f7a15bf4350f8addf399e20bda.tar.gz mana-client-59657fcbfa88a8f7a15bf4350f8addf399e20bda.tar.bz2 mana-client-59657fcbfa88a8f7a15bf4350f8addf399e20bda.tar.xz mana-client-59657fcbfa88a8f7a15bf4350f8addf399e20bda.zip |
Make sure item icons in the invy are full opacity
Diffstat (limited to 'src')
-rw-r--r-- | src/flooritem.cpp | 10 | ||||
-rw-r--r-- | src/item.cpp | 8 | ||||
-rw-r--r-- | src/item.h | 6 |
3 files changed, 19 insertions, 5 deletions
diff --git a/src/flooritem.cpp b/src/flooritem.cpp index b2f6376b..9420afb4 100644 --- a/src/flooritem.cpp +++ b/src/flooritem.cpp @@ -67,11 +67,11 @@ void FloorItem::draw(Graphics *graphics, int offsetX, int offsetY) const { if (mItem) { - if (mAlpha != mItem->getImage()->getAlpha()) - mItem->getImage()->setAlpha(mAlpha); + Image *image = mItem->getDrawImage(); - graphics->drawImage(mItem->getImage(), - mX * 32 + offsetX, - mY * 32 + offsetY); + if (image && mAlpha != image->getAlpha()) + image->setAlpha(mAlpha); + + graphics->drawImage(image, mX * 32 + offsetX, mY * 32 + offsetY); } } diff --git a/src/item.cpp b/src/item.cpp index 46905e5c..120a4044 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -27,6 +27,7 @@ Item::Item(int id, int quantity, bool equipment, bool equipped): mImage(0), + mDrawImage(0), mQuantity(quantity), mEquipment(equipment), mEquipped(equipped), mInEquipment(false) { @@ -50,10 +51,17 @@ void Item::setId(int id) if (mImage) mImage->decRef(); + if (mDrawImage) + mDrawImage->decRef(); + ResourceManager *resman = ResourceManager::getInstance(); std::string imagePath = "graphics/items/" + getInfo().getImageName(); mImage = resman->getImage(imagePath); + mDrawImage = resman->getImage(imagePath); if (!mImage) mImage = resman->getImage("graphics/gui/unknown-item.png"); + + if (!mDrawImage) + mDrawImage = resman->getImage("graphics/gui/unknown-item.png"); } @@ -59,6 +59,11 @@ class Item Image *getImage() { return mImage; } /** + * Returns the item image. + */ + Image *getDrawImage() { return mDrawImage; } + + /** * Sets the number of items. */ void setQuantity(int quantity) { mQuantity = quantity; } @@ -121,6 +126,7 @@ class Item protected: int mId; /**< Item type id. */ Image *mImage; /**< Item image. */ + Image *mDrawImage; /**< Draw image. */ int mQuantity; /**< Number of items. */ bool mEquipment; /**< Item is equipment. */ bool mEquipped; /**< Item is equipped. */ |