diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-06-21 15:09:39 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-06-21 15:09:39 +0300 |
commit | 3d524b386e3dd6d89d481749cd0015bff247a703 (patch) | |
tree | adc0d84377175320083738168229cdf20ff48e27 /src/being/being.cpp | |
parent | 71cccfd289845fcd31e64f35d600ebafd4aa29c6 (diff) | |
download | ManaVerse-3d524b386e3dd6d89d481749cd0015bff247a703.tar.gz ManaVerse-3d524b386e3dd6d89d481749cd0015bff247a703.tar.bz2 ManaVerse-3d524b386e3dd6d89d481749cd0015bff247a703.tar.xz ManaVerse-3d524b386e3dd6d89d481749cd0015bff247a703.zip |
In Being split setSpriteId into setSpriteId and unSetSprite.
Diffstat (limited to 'src/being/being.cpp')
-rw-r--r-- | src/being/being.cpp | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/src/being/being.cpp b/src/being/being.cpp index 19678cf64..e0980e4d7 100644 --- a/src/being/being.cpp +++ b/src/being/being.cpp @@ -2576,6 +2576,45 @@ void Being::setSpriteId(const unsigned int slot, beingEquipmentWindow->updateBeing(this); } +// reset sprite id, reset colors, reset cards +void Being::unSetSprite(const unsigned int slot) restrict2 +{ + if (!charServerHandler || slot >= charServerHandler->maxSprite()) + return; + + if (slot >= CAST_U32(mSprites.size())) + ensureSize(slot + 1); + + if (slot >= CAST_U32(mSlots.size())) + mSlots.resize(slot + 1, BeingSlot()); + + removeSprite(slot); + mSpriteDraw[slot] = 0; + + BeingSlot &beingSlot = mSlots[slot]; + const int id1 = beingSlot.spriteId; + if (id1) + { + const ItemInfo &info = ItemDB::get(id1); + if (mMap && + mType == ActorType::Player) + { + const BeingId pet = fromInt(info.getPet(), BeingId); + if (pet != BeingId_zero) + removePet(pet); + } + removeItemParticles(id1); + } + + beingSlot.spriteId = 0; + beingSlot.color = std::string(); + beingSlot.colorId = ItemColor_one; + beingSlot.cardsId = CardsList(nullptr); + recalcSpritesOrder(); + if (beingEquipmentWindow) + beingEquipmentWindow->updateBeing(this); +} + // set sprite id, colors, reset cards void Being::setSprite(const unsigned int slot, const int id, @@ -3936,8 +3975,7 @@ void Being::undressItemById(const int id) restrict2 { if (id == mSlots[f].spriteId) { - setSpriteId(CAST_U32(f), - 0); + unSetSprite(CAST_U32(f)); break; } } |