From 41cc92f73e39cec5dfea6b1164176610cccc7df4 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 15 Aug 2015 13:58:32 +0300 Subject: Add strong typed int for item color. --- src/gui/windows/outfitwindow.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/gui/windows/outfitwindow.cpp') diff --git a/src/gui/windows/outfitwindow.cpp b/src/gui/windows/outfitwindow.cpp index a0a7fa7c2..7ce43333b 100644 --- a/src/gui/windows/outfitwindow.cpp +++ b/src/gui/windows/outfitwindow.cpp @@ -172,7 +172,7 @@ void OutfitWindow::load(const bool oldConfig) for (size_t i = 0, sz = tokens2.size(); i < sz && i < OUTFIT_ITEM_COUNT; i++) { - mItemColors[o][i] = tokens2[i]; + mItemColors[o][i] = fromInt(tokens2[i], ItemColor); } mItemsUnequip[o] = cfg->getValueBool("OutfitUnequip" + toString(o), @@ -203,7 +203,7 @@ void OutfitWindow::save() const if (i < OUTFIT_ITEM_COUNT - 1) outfitStr.append(" "); outfitColorsStr.append(toString(static_cast( - mItemColors[o][i]))); + toInt(mItemColors[o][i], int)))); if (i < OUTFIT_ITEM_COUNT - 1) outfitColorsStr.append(" "); } @@ -278,7 +278,8 @@ void OutfitWindow::wearOutfit(const int outfit, const bool unwearEmpty, for (unsigned i = 0; i < OUTFIT_ITEM_COUNT; i++) { const Item *const item = PlayerInfo::getInventory()->findItem( - mItems[outfit][i], mItemColors[outfit][i]); + mItems[outfit][i], + mItemColors[outfit][i]); if (item && item->isEquipped() == Equipped_false && item->getQuantity()) @@ -453,7 +454,7 @@ void OutfitWindow::mouseDragged(MouseEvent &event) return; } const int itemId = mItems[mCurrentOutfit][index]; - const unsigned char itemColor = mItemColors[mCurrentOutfit][index]; + const ItemColor itemColor = mItemColors[mCurrentOutfit][index]; if (itemId < 0) { Window::mouseDragged(event); @@ -719,7 +720,7 @@ void OutfitWindow::clearCurrentOutfit() for (unsigned f = 0; f < OUTFIT_ITEM_COUNT; f++) { mItems[mCurrentOutfit][f] = -1; - mItemColors[mCurrentOutfit][f] = 1; + mItemColors[mCurrentOutfit][f] = ItemColor_one; } save(); } -- cgit v1.2.3-70-g09d2