summaryrefslogtreecommitdiff
path: root/src/itemcolormanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/itemcolormanager.cpp')
-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;
}