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/homunculushandler.cpp | |
parent | 01773c71a4698c6f01fe70d864f922bda65506cb (diff) | |
download | manaplus-0f9ec2061c4ad6157c3186f1cab9c4d8558980b5.tar.gz manaplus-0f9ec2061c4ad6157c3186f1cab9c4d8558980b5.tar.bz2 manaplus-0f9ec2061c4ad6157c3186f1cab9c4d8558980b5.tar.xz manaplus-0f9ec2061c4ad6157c3186f1cab9c4d8558980b5.zip |
Add strong typed int type BeingId.
Diffstat (limited to 'src/net/eathena/homunculushandler.cpp')
-rw-r--r-- | src/net/eathena/homunculushandler.cpp | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/net/eathena/homunculushandler.cpp b/src/net/eathena/homunculushandler.cpp index 2bfe358c2..e2441ac14 100644 --- a/src/net/eathena/homunculushandler.cpp +++ b/src/net/eathena/homunculushandler.cpp @@ -127,7 +127,7 @@ void HomunculusHandler::processHomunculusData(Net::MessageIn &msg) { msg.readUInt8("unused"); const int cmd = msg.readUInt8("state"); - const int id = msg.readInt32("homunculus id"); + const BeingId id = msg.readBeingId("homunculus id"); Being *const dstBeing = actorManager->findBeing(id); const int data = msg.readInt32("data"); if (!cmd) // pre init @@ -243,33 +243,34 @@ void HomunculusHandler::setName(const std::string &name) const void HomunculusHandler::moveToMaster() const { - const int id = PlayerInfo::getHomunculusId(); - if (!id) + const BeingId id = PlayerInfo::getHomunculusId(); + if (id == BeingId_zero) return; createOutPacket(CMSG_HOMMERC_MOVE_TO_MASTER); - outMsg.writeInt32(id, "homunculus id"); + outMsg.writeBeingId(id, "homunculus id"); } void HomunculusHandler::move(const int x, const int y) const { - const int id = PlayerInfo::getHomunculusId(); - if (!id) + const BeingId id = PlayerInfo::getHomunculusId(); + if (id == BeingId_zero) return; createOutPacket(CMSG_HOMMERC_MOVE_TO); - outMsg.writeInt32(id, "homunculus id"); + outMsg.writeBeingId(id, "homunculus id"); outMsg.writeCoordinates(static_cast<uint16_t>(x), static_cast<uint16_t>(y), 0U, "position"); } -void HomunculusHandler::attack(const int targetId, const Keep keep) const +void HomunculusHandler::attack(const BeingId targetId, + const Keep keep) const { - const int id = PlayerInfo::getHomunculusId(); - if (!id) + const BeingId id = PlayerInfo::getHomunculusId(); + if (id == BeingId_zero) return; createOutPacket(CMSG_HOMMERC_ATTACK); - outMsg.writeInt32(id, "homunculus id"); - outMsg.writeInt32(targetId, "target id"); + outMsg.writeBeingId(id, "homunculus id"); + outMsg.writeBeingId(targetId, "target id"); outMsg.writeInt8(static_cast<int8_t>(keep == Keep_true ? 1 : 0), "keep"); } |