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 | |
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.
-rw-r--r-- | src/being/being.cpp | 42 | ||||
-rw-r--r-- | src/being/being.h | 2 | ||||
-rw-r--r-- | src/net/eathena/beinghandler.cpp | 45 | ||||
-rw-r--r-- | src/net/eathena/charserverrecv.cpp | 3 | ||||
-rw-r--r-- | src/net/tmwa/beinghandler.cpp | 15 | ||||
-rw-r--r-- | src/net/tmwa/charserverrecv.cpp | 3 |
6 files changed, 64 insertions, 46 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; } } diff --git a/src/being/being.h b/src/being/being.h index 79068b255..03626bc75 100644 --- a/src/being/being.h +++ b/src/being/being.h @@ -329,6 +329,8 @@ class Being notfinal : public ActorSprite, void setSpriteId(const unsigned int slot, const int id) restrict2; + void unSetSprite(const unsigned int slot) restrict2; + void setWeaponId(const int id) restrict2; void setTempSprite(const unsigned int slot, diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp index dbf797e2b..418876b0d 100644 --- a/src/net/eathena/beinghandler.cpp +++ b/src/net/eathena/beinghandler.cpp @@ -50,36 +50,21 @@ void BeingHandler::undress(Being *const being) const { if (!being) return; - being->setSpriteId(SPRITE_WEAPON, - 0); - being->setSpriteId(SPRITE_HEAD_BOTTOM, - 0); - being->setSpriteId(SPRITE_HEAD_TOP, - 0); - being->setSpriteId(SPRITE_HEAD_MID, - 0); - being->setSpriteId(SPRITE_CLOTHES_COLOR, - 0); - being->setSpriteId(SPRITE_SHIELD, - 0); - being->setSpriteId(SPRITE_FLOOR, - 0); - being->setSpriteId(SPRITE_ROBE, - 0); - being->setSpriteId(SPRITE_EVOL2, - 0); - being->setSpriteId(SPRITE_EVOL3, - 0); - being->setSpriteId(SPRITE_EVOL4, - 0); - being->setSpriteId(SPRITE_EVOL5, - 0); - being->setSpriteId(SPRITE_EVOL6, - 0); - being->setSpriteId(SPRITE_HAIR, - 0); - being->setSpriteId(SPRITE_SHOES, - 0); + being->unSetSprite(SPRITE_WEAPON); + being->unSetSprite(SPRITE_HEAD_BOTTOM); + being->unSetSprite(SPRITE_HEAD_TOP); + being->unSetSprite(SPRITE_HEAD_MID); + being->unSetSprite(SPRITE_CLOTHES_COLOR); + being->unSetSprite(SPRITE_SHIELD); + being->unSetSprite(SPRITE_FLOOR); + being->unSetSprite(SPRITE_ROBE); + being->unSetSprite(SPRITE_EVOL2); + being->unSetSprite(SPRITE_EVOL3); + being->unSetSprite(SPRITE_EVOL4); + being->unSetSprite(SPRITE_EVOL5); + being->unSetSprite(SPRITE_EVOL6); + being->unSetSprite(SPRITE_HAIR); + being->unSetSprite(SPRITE_SHOES); } void BeingHandler::requestRanks(const RankT rank) const diff --git a/src/net/eathena/charserverrecv.cpp b/src/net/eathena/charserverrecv.cpp index 555a876be..3ddb6af95 100644 --- a/src/net/eathena/charserverrecv.cpp +++ b/src/net/eathena/charserverrecv.cpp @@ -147,8 +147,7 @@ void CharServerRecv::readPlayerData(Net::MessageIn &msg, tempPlayer->setHairColor(color); if (hairStyle == 0) { - tempPlayer->setSpriteId(SPRITE_HAIR_COLOR, - 0); + tempPlayer->unSetSprite(SPRITE_HAIR_COLOR); } else { diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp index 346aedf58..3629cf8a7 100644 --- a/src/net/tmwa/beinghandler.cpp +++ b/src/net/tmwa/beinghandler.cpp @@ -49,16 +49,11 @@ void BeingHandler::undress(Being *const being) const { if (!being) return; - being->setSpriteId(SPRITE_WEAPON, - 0); - being->setSpriteId(SPRITE_HEAD_BOTTOM, - 0); - being->setSpriteId(SPRITE_CLOTHES_COLOR, - 0); - being->setSpriteId(SPRITE_HAIR, - 0); - being->setSpriteId(SPRITE_SHOES, - 0); + being->unSetSprite(SPRITE_WEAPON); + being->unSetSprite(SPRITE_HEAD_BOTTOM); + being->unSetSprite(SPRITE_CLOTHES_COLOR); + being->unSetSprite(SPRITE_HAIR); + being->unSetSprite(SPRITE_SHOES); } #ifdef EATHENA_SUPPORT diff --git a/src/net/tmwa/charserverrecv.cpp b/src/net/tmwa/charserverrecv.cpp index 85f06159d..242e3e489 100644 --- a/src/net/tmwa/charserverrecv.cpp +++ b/src/net/tmwa/charserverrecv.cpp @@ -124,8 +124,7 @@ void CharServerRecv::readPlayerData(Net::MessageIn &msg, msg.readUInt8("unused"); if (hairStyle == 0) { - tempPlayer->setSpriteId(SPRITE_HAIR_COLOR, - 0); + tempPlayer->unSetSprite(SPRITE_HAIR_COLOR); } else { |