From f582b2ea6a8f311b47377bcf45f05066639e5a3d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 20 Jun 2016 21:09:08 +0300 Subject: In Being replace mSpriteColorIds to using mSlots field. --- src/being/being.cpp | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) (limited to 'src/being/being.cpp') diff --git a/src/being/being.cpp b/src/being/being.cpp index 7881edb5d..69056cf44 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -170,7 +170,6 @@ Being::Being(const BeingId id, mDest(), mSpriteColors(), mSlots(), - mSpriteColorsIds(), mSpriteParticles(), mGuilds(), mParty(nullptr), @@ -2508,9 +2507,6 @@ void Being::setSprite(const unsigned int slot, if (slot >= CAST_U32(mSpriteColors.size())) mSpriteColors.resize(slot + 1, ""); - if (slot >= CAST_U32(mSpriteColorsIds.size())) - mSpriteColorsIds.resize(slot + 1, ItemColor_one); - // disabled for now, because it may broke replace/reorder sprites logic // if (slot && mSlots[slot].spriteId == id) // return; @@ -2589,7 +2585,7 @@ void Being::setSprite(const unsigned int slot, mSlots[slot].spriteId = id; mSpriteColors[slot] = color; - mSpriteColorsIds[slot] = colorId; + mSlots[slot].colorId = colorId; mSlots[slot].cardsId = CardsList(cards); recalcSpritesOrder(); if (beingEquipmentWindow) @@ -2621,9 +2617,6 @@ void Being::setTempSprite(const unsigned int slot, if (slot >= CAST_U32(mSpriteColors.size())) mSpriteColors.resize(slot + 1, ""); - if (slot >= CAST_U32(mSpriteColorsIds.size())) - mSpriteColorsIds.resize(slot + 1, ItemColor_one); - // id = 0 means unequip if (id == 0) { @@ -2734,15 +2727,15 @@ void Being::dumpSprites() const restrict2 const std::vector::const_iterator it1_end = mSlots.end(); StringVectCIter it2 = mSpriteColors.begin(); const StringVectCIter it2_end = mSpriteColors.end(); - std::vector::const_iterator it3 = mSpriteColorsIds.begin(); - const std::vector::const_iterator - it3_end = mSpriteColorsIds.end(); logger->log("sprites"); - for (; it1 != it1_end && it2 != it2_end && it3 != it3_end; - ++ it1, ++ it2, ++ it3) + for (; it1 != it1_end && it2 != it2_end; + ++ it1, ++ it2) { - logger->log("%d,%s,%d", (*it1).spriteId, (*it2).c_str(), toInt(*it3, int)); + logger->log("%d,%s,%d", + (*it1).spriteId, + (*it2).c_str(), + toInt((*it1).colorId, int)); } } @@ -3983,10 +3976,10 @@ int Being::getSpriteID(const int slot) const restrict2 ItemColor Being::getSpriteColor(const int slot) const restrict2 { - if (slot < 0 || CAST_SIZE(slot) >= mSpriteColorsIds.size()) + if (slot < 0 || CAST_SIZE(slot) >= mSlots.size()) return ItemColor_one; - return mSpriteColorsIds[slot]; + return mSlots[slot].colorId; } void Being::addAfkEffect() restrict2 -- cgit v1.2.3-60-g2f50