summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-08-17 00:06:19 +0300
committerAndrei Karas <akaras@inbox.ru>2015-08-17 00:06:19 +0300
commit9fe27169625eb51dbab172bb3d9cb27a06141486 (patch)
tree0347bc106298ce724ead731f92df6ad0ee5edae5
parentead2b06e3496b0cbe3a4a4c33a55c8262f02b73f (diff)
downloadplus-9fe27169625eb51dbab172bb3d9cb27a06141486.tar.gz
plus-9fe27169625eb51dbab172bb3d9cb27a06141486.tar.bz2
plus-9fe27169625eb51dbab172bb3d9cb27a06141486.tar.xz
plus-9fe27169625eb51dbab172bb3d9cb27a06141486.zip
Use color selected on card for items.
-rw-r--r--src/itemcolormanager.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/itemcolormanager.cpp b/src/itemcolormanager.cpp
index 31f4c333c..55ec558ac 100644
--- a/src/itemcolormanager.cpp
+++ b/src/itemcolormanager.cpp
@@ -22,9 +22,20 @@
#include "resources/iteminfo.h"
+#include "resources/db/itemdb.h"
+
#include "debug.h"
ItemColor ItemColorManager::getColorFromCards(const int *const cards)
{
+ if (!cards)
+ return ItemColor_one;
+ for (int f = 0; f < 4; f ++)
+ {
+ const ItemInfo &info = ItemDB::get(cards[f]);
+ const ItemColor &color = info.getCardColor();
+ if (color != ItemColor_zero)
+ return color;
+ }
return ItemColor_one;
}