diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-08-15 13:58:32 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-08-16 01:52:14 +0300 |
commit | 41cc92f73e39cec5dfea6b1164176610cccc7df4 (patch) | |
tree | 22fd3d388084d2c61fe80f0441c3c30ab8ffd33c /src/inventory.cpp | |
parent | 7aa637abc8b0bca35aacdb9492e65f557ed32038 (diff) | |
download | plus-41cc92f73e39cec5dfea6b1164176610cccc7df4.tar.gz plus-41cc92f73e39cec5dfea6b1164176610cccc7df4.tar.bz2 plus-41cc92f73e39cec5dfea6b1164176610cccc7df4.tar.xz plus-41cc92f73e39cec5dfea6b1164176610cccc7df4.zip |
Add strong typed int for item color.
Diffstat (limited to 'src/inventory.cpp')
-rw-r--r-- | src/inventory.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/inventory.cpp b/src/inventory.cpp index 8b396e1d5..c83ea5353 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -83,15 +83,18 @@ Item *Inventory::getItem(const int index) const return mItems[index]; } -Item *Inventory::findItem(const int itemId, const unsigned char color) const +Item *Inventory::findItem(const int itemId, + const ItemColor color) const { for (unsigned i = 0; i < mSize; i++) { Item *const item = mItems[i]; if (item && item->mId == itemId) { - if (color == 0 || item->mColor == color - || (color == 1 && item->mColor <= 1)) + if (color == ItemColor_zero || + item->mColor == color || + (color == ItemColor_one && + item->mColor <= ItemColor_one)) { return item; } @@ -105,7 +108,7 @@ int Inventory::addItem(const int id, const int type, const int quantity, const uint8_t refine, - const uint8_t color, + const ItemColor color, const Identified identified, const Damaged damaged, const Favorite favorite, @@ -123,7 +126,7 @@ void Inventory::setItem(const int index, const int type, const int quantity, const uint8_t refine, - const unsigned char color, + const ItemColor color, const Identified identified, const Damaged damaged, const Favorite favorite, |