summaryrefslogtreecommitdiff
path: root/src/item.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-07-15 02:37:23 +0300
committerAndrei Karas <akaras@inbox.ru>2015-07-15 02:37:23 +0300
commit5fc61f321cbe6c8f4a4e6529c27603302f3d5eba (patch)
tree7b5561a239e10bb6437b94a681f66c524c4d8d91 /src/item.cpp
parent4761556e5e4cf8471ab65c65c2b3fd4003ac5ba0 (diff)
downloadmanaplus-5fc61f321cbe6c8f4a4e6529c27603302f3d5eba.tar.gz
manaplus-5fc61f321cbe6c8f4a4e6529c27603302f3d5eba.tar.bz2
manaplus-5fc61f321cbe6c8f4a4e6529c27603302f3d5eba.tar.xz
manaplus-5fc61f321cbe6c8f4a4e6529c27603302f3d5eba.zip
Update existing item after inserting card.
Diffstat (limited to 'src/item.cpp')
-rw-r--r--src/item.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/item.cpp b/src/item.cpp
index d42a11859..7fa816c86 100644
--- a/src/item.cpp
+++ b/src/item.cpp
@@ -160,3 +160,15 @@ void Item::setCards(const int *const cards, const int size)
for (int f = 0; f < sz; f ++)
mCards[f] = cards[f];
}
+
+void Item::addCard(const int card)
+{
+ for (int f = 0; f < maxCards; f ++)
+ {
+ if (!mCards[f])
+ {
+ mCards[f] = card;
+ return;
+ }
+ }
+}