diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-05-29 14:30:20 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-05-29 14:30:20 +0300 |
commit | 0f9ec2061c4ad6157c3186f1cab9c4d8558980b5 (patch) | |
tree | 6259593b8436178ad8d981a96a8fd71eab9e04cc /src/net/eathena/mercenaryhandler.cpp | |
parent | 01773c71a4698c6f01fe70d864f922bda65506cb (diff) | |
download | plus-0f9ec2061c4ad6157c3186f1cab9c4d8558980b5.tar.gz plus-0f9ec2061c4ad6157c3186f1cab9c4d8558980b5.tar.bz2 plus-0f9ec2061c4ad6157c3186f1cab9c4d8558980b5.tar.xz plus-0f9ec2061c4ad6157c3186f1cab9c4d8558980b5.zip |
Add strong typed int type BeingId.
Diffstat (limited to 'src/net/eathena/mercenaryhandler.cpp')
-rw-r--r-- | src/net/eathena/mercenaryhandler.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/net/eathena/mercenaryhandler.cpp b/src/net/eathena/mercenaryhandler.cpp index ebdba730e..82f7b59c2 100644 --- a/src/net/eathena/mercenaryhandler.cpp +++ b/src/net/eathena/mercenaryhandler.cpp @@ -90,7 +90,7 @@ void MercenaryHandler::processMercenaryUpdate(Net::MessageIn &msg) void MercenaryHandler::processMercenaryInfo(Net::MessageIn &msg) { // +++ need create if need mercenary being and update stats - Being *const dstBeing = actorManager->findBeing(msg.readInt32("being id")); + Being *const dstBeing = actorManager->findBeing(msg.readBeingId("being id")); msg.readInt16("atk"); msg.readInt16("matk"); msg.readInt16("hit"); @@ -188,33 +188,34 @@ void MercenaryHandler::fire() void MercenaryHandler::moveToMaster() const { - const int id = PlayerInfo::getMercenaryId(); - if (!id) + const BeingId id = PlayerInfo::getMercenaryId(); + if (id == BeingId_zero) return; createOutPacket(CMSG_HOMMERC_MOVE_TO_MASTER); - outMsg.writeInt32(id, "mercenary id"); + outMsg.writeBeingId(id, "mercenary id"); } void MercenaryHandler::move(const int x, const int y) const { - const int id = PlayerInfo::getMercenaryId(); - if (!id) + const BeingId id = PlayerInfo::getMercenaryId(); + if (id == BeingId_zero) return; createOutPacket(CMSG_HOMMERC_MOVE_TO); - outMsg.writeInt32(id, "mercenary id"); + outMsg.writeBeingId(id, "mercenary id"); outMsg.writeCoordinates(static_cast<uint16_t>(x), static_cast<uint16_t>(y), 0U, "position"); } -void MercenaryHandler::attack(const int targetId, const Keep keep) const +void MercenaryHandler::attack(const BeingId targetId, + const Keep keep) const { - const int id = PlayerInfo::getMercenaryId(); - if (!id) + const BeingId id = PlayerInfo::getMercenaryId(); + if (id == BeingId_zero) return; createOutPacket(CMSG_HOMMERC_ATTACK); - outMsg.writeInt32(id, "mercenary id"); - outMsg.writeInt32(targetId, "target id"); + outMsg.writeBeingId(id, "mercenary id"); + outMsg.writeBeingId(targetId, "target id"); outMsg.writeInt8(static_cast<int8_t>(keep == Keep_true ? 1 : 0), "keep"); } |