summaryrefslogtreecommitdiff
path: root/src/being/being.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-06-19 23:04:05 +0300
committerAndrei Karas <akaras@inbox.ru>2016-06-20 01:48:03 +0300
commit9dfde677430ab0dc1c11807b2b0d9f76bab353bb (patch)
tree92907f9c9467cf798c2b6fa392df9eefaebf4898 /src/being/being.cpp
parent8462b9ae346a41a37b2790c3ea5f14f0e783ab71 (diff)
downloadplus-9dfde677430ab0dc1c11807b2b0d9f76bab353bb.tar.gz
plus-9dfde677430ab0dc1c11807b2b0d9f76bab353bb.tar.bz2
plus-9dfde677430ab0dc1c11807b2b0d9f76bab353bb.tar.xz
plus-9dfde677430ab0dc1c11807b2b0d9f76bab353bb.zip
Add support for stored cards with sprites in Being.
Diffstat (limited to 'src/being/being.cpp')
-rw-r--r--src/being/being.cpp45
1 files changed, 28 insertions, 17 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp
index db8eec991..66b01acb3 100644
--- a/src/being/being.cpp
+++ b/src/being/being.cpp
@@ -170,6 +170,7 @@ Being::Being(const BeingId id,
mDest(),
mSpriteColors(),
mSpriteIDs(),
+ mSpriteCardsIds(),
mSpriteColorsIds(),
mSpriteParticles(),
mGuilds(),
@@ -2485,16 +2486,19 @@ void Being::updateSprite(const unsigned int slot,
if (slot >= CAST_U32(mSpriteIDs.size()))
mSpriteIDs.resize(slot + 1, 0);
+ if (slot >= CAST_U32(mSpriteCardsIds.size()))
+ mSpriteCardsIds.resize(slot + 1, zeroCards);
+
if (slot && mSpriteIDs[slot] == id)
return;
- setSprite(slot, id, color, colorId, nullptr);
+ setSprite(slot, id, color, colorId, mSpriteCardsIds[slot]);
}
void Being::setSprite(const unsigned int slot,
const int id,
std::string color,
ItemColor colorId,
- const int *const cards) restrict2
+ CardsList cards) restrict2
{
if (!charServerHandler || slot >= charServerHandler->maxSprite())
return;
@@ -2505,6 +2509,9 @@ void Being::setSprite(const unsigned int slot,
if (slot >= CAST_U32(mSpriteIDs.size()))
mSpriteIDs.resize(slot + 1, 0);
+ if (slot >= CAST_U32(mSpriteCardsIds.size()))
+ mSpriteCardsIds.resize(slot + 1, zeroCards);
+
if (slot >= CAST_U32(mSpriteColors.size()))
mSpriteColors.resize(slot + 1, "");
@@ -2551,7 +2558,7 @@ void Being::setSprite(const unsigned int slot,
addPet(pet);
}
- if (cards != nullptr)
+ if (!cards.isEmpty())
colorId = ItemColorManager::getColorFromCards(cards);
if (!filename.empty())
@@ -2590,6 +2597,7 @@ void Being::setSprite(const unsigned int slot,
mSpriteIDs[slot] = id;
mSpriteColors[slot] = color;
mSpriteColorsIds[slot] = colorId;
+ mSpriteCardsIds[slot] = CardsList(cards);
recalcSpritesOrder();
if (beingEquipmentWindow)
beingEquipmentWindow->updateBeing(this);
@@ -2606,7 +2614,7 @@ void Being::setWeaponId(const int id) restrict2
void Being::setTempSprite(const unsigned int slot,
const int id,
std::string color,
- const int *const cards) restrict2
+ CardsList cards) restrict2
{
if (!charServerHandler || slot >= charServerHandler->maxSprite())
return;
@@ -2617,6 +2625,9 @@ void Being::setTempSprite(const unsigned int slot,
if (slot >= CAST_U32(mSpriteIDs.size()))
mSpriteIDs.resize(slot + 1, 0);
+ if (slot >= CAST_U32(mSpriteCardsIds.size()))
+ mSpriteCardsIds.resize(slot + 1, zeroCards);
+
if (slot >= CAST_U32(mSpriteColors.size()))
mSpriteColors.resize(slot + 1, "");
@@ -2643,7 +2654,7 @@ void Being::setTempSprite(const unsigned int slot,
AnimatedSprite *restrict equipmentSprite = nullptr;
ItemColor colorId = ItemColor_one;
- if (cards != nullptr)
+ if (!cards.isEmpty())
colorId = ItemColorManager::getColorFromCards(cards);
if (!filename.empty())
@@ -2687,7 +2698,7 @@ void Being::setSpriteID(const unsigned int slot,
id,
mSpriteColors[slot],
ItemColor_one,
- nullptr);
+ mSpriteCardsIds[slot]);
}
void Being::setSpriteColor(const unsigned int slot,
@@ -2697,7 +2708,7 @@ void Being::setSpriteColor(const unsigned int slot,
mSpriteIDs[slot],
color,
ItemColor_one,
- nullptr);
+ mSpriteCardsIds[slot]);
}
void Being::setHairStyle(const unsigned int slot,
@@ -2708,7 +2719,7 @@ void Being::setHairStyle(const unsigned int slot,
id,
ItemDB::get(id).getDyeColorsString(mHairColor),
ItemColor_one,
- nullptr);
+ mSpriteCardsIds[slot]);
// dumpSprites();
}
@@ -2723,7 +2734,7 @@ void Being::setHairColor(const unsigned int slot,
mSpriteIDs[slot],
ItemDB::get(id).getDyeColorsString(color),
ItemColor_one,
- nullptr);
+ mSpriteCardsIds[slot]);
}
}
@@ -2912,7 +2923,7 @@ void Being::setGender(const GenderT gender) restrict2
mSpriteIDs[i],
mSpriteColors[i],
ItemColor_one,
- nullptr);
+ mSpriteCardsIds[i]);
}
}
@@ -3484,7 +3495,7 @@ void Being::recalcSpritesOrder() restrict2
setTempSprite(remSprite,
repIt->second,
mSpriteColors[remSprite],
- nullptr);
+ mSpriteCardsIds[remSprite]);
}
else
{
@@ -3492,7 +3503,7 @@ void Being::recalcSpritesOrder() restrict2
repIt->second,
ItemDB::get(repIt->second)
.getDyeColorsString(mHairColor),
- nullptr);
+ mSpriteCardsIds[remSprite]);
}
updatedSprite[remSprite] = true;
}
@@ -3515,7 +3526,7 @@ void Being::recalcSpritesOrder() restrict2
setTempSprite(slot2,
repIt->second,
mSpriteColors[slot2],
- nullptr);
+ mSpriteCardsIds[slot2]);
}
else
{
@@ -3524,7 +3535,7 @@ void Being::recalcSpritesOrder() restrict2
ItemDB::get(repIt->second)
.getDyeColorsString(
mHairColor),
- nullptr);
+ mSpriteCardsIds[slot2]);
}
updatedSprite[slot2] = true;
}
@@ -3669,7 +3680,7 @@ void Being::recalcSpritesOrder() restrict2
setTempSprite(slot,
id,
mSpriteColors[slot],
- nullptr);
+ mSpriteCardsIds[slot]);
}
}
}
@@ -3684,7 +3695,7 @@ void Being::recalcSpritesOrder() restrict2
setTempSprite(static_cast<unsigned int>(slot),
id,
mSpriteColors[slot],
- nullptr);
+ mSpriteCardsIds[slot]);
}
}
}
@@ -3758,7 +3769,7 @@ void Being::undressItemById(const int id) restrict2
0,
std::string(),
ItemColor_one,
- nullptr);
+ zeroCards);
break;
}
}