diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-08-17 00:31:59 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-08-17 00:31:59 +0300 |
commit | 61483740edea22a6f5ef974f7b2b0796ff49fb6e (patch) | |
tree | 994d5335111234926948ae6e243aff178f37692f | |
parent | 9fe27169625eb51dbab172bb3d9cb27a06141486 (diff) | |
download | manaplus-61483740edea22a6f5ef974f7b2b0796ff49fb6e.tar.gz manaplus-61483740edea22a6f5ef974f7b2b0796ff49fb6e.tar.bz2 manaplus-61483740edea22a6f5ef974f7b2b0796ff49fb6e.tar.xz manaplus-61483740edea22a6f5ef974f7b2b0796ff49fb6e.zip |
Fix item icon color if insert card in it.
-rw-r--r-- | src/item.cpp | 9 | ||||
-rw-r--r-- | src/item.h | 5 | ||||
-rw-r--r-- | src/net/eathena/inventoryhandler.cpp | 1 |
3 files changed, 14 insertions, 1 deletions
diff --git a/src/item.cpp b/src/item.cpp index 0ccfd025a..d0c30371a 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -22,13 +22,14 @@ #include "item.h" +#include "configuration.h" #include "dragdrop.h" +#include "itemcolormanager.h" #include "gui/theme.h" #include "resources/iteminfo.h" #include "resources/resourcemanager.h" -#include "configuration.h" #include "net/serverfeatures.h" @@ -174,3 +175,9 @@ void Item::addCard(const int card) } } } + +void Item::updateColor() +{ + if (serverFeatures->haveItemColors()) + setId(mId, ItemColorManager::getColorFromCards(&mCards[0])); +} diff --git a/src/item.h b/src/item.h index c3b22a9dc..7df66f4b9 100644 --- a/src/item.h +++ b/src/item.h @@ -176,6 +176,9 @@ class Item notfinal ItemColor getColor() const A_WARN_UNUSED { return mColor; } + void setColor(const ItemColor color) + { mColor = color; } + const std::string &getDescription() const A_WARN_UNUSED { return mDescription; } @@ -214,6 +217,8 @@ class Item notfinal void addCard(const int card); + void updateColor(); + int mId; /**< Item type id. */ ItemColor mColor; int mQuantity; /**< Number of items. */ diff --git a/src/net/eathena/inventoryhandler.cpp b/src/net/eathena/inventoryhandler.cpp index 30ec030cc..48fdb67b8 100644 --- a/src/net/eathena/inventoryhandler.cpp +++ b/src/net/eathena/inventoryhandler.cpp @@ -877,6 +877,7 @@ void InventoryHandler::processPlayerInsertCard(Net::MessageIn &msg) if (item) { item->addCard(cardId); + item->updateColor(); itemPopup->resetPopup(); } } |