From 2d32dc27210d16102f9200de115f2c3f79a5cb22 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 29 May 2015 17:45:52 +0300 Subject: Use BeingTypeId in Being for subtypeid. --- src/net/ea/beinghandler.cpp | 5 +++-- src/net/ea/beinghandler.h | 2 +- src/net/eathena/beinghandler.cpp | 13 +++++++------ src/net/eathena/charserverhandler.cpp | 4 ++-- src/net/eathena/pethandler.cpp | 3 ++- src/net/tmwa/beinghandler.cpp | 12 ++++++------ src/net/tmwa/charserverhandler.cpp | 4 ++-- 7 files changed, 23 insertions(+), 20 deletions(-) (limited to 'src/net') diff --git a/src/net/ea/beinghandler.cpp b/src/net/ea/beinghandler.cpp index ab32a3f84..5bfdf5212 100644 --- a/src/net/ea/beinghandler.cpp +++ b/src/net/ea/beinghandler.cpp @@ -53,7 +53,7 @@ BeingHandler::BeingHandler(const bool enableSync) } Being *BeingHandler::createBeing(const BeingId id, - const int16_t job) + const int job) { if (!actorManager) return nullptr; @@ -68,7 +68,8 @@ Being *BeingHandler::createBeing(const BeingId id, else if (job == 45) type = ActorType::Portal; - Being *const being = actorManager->createBeing(id, type, job); + Being *const being = actorManager->createBeing( + id, type, fromInt(job, BeingTypeId)); return being; } diff --git a/src/net/ea/beinghandler.h b/src/net/ea/beinghandler.h index 632381fb3..55e4a3ef2 100644 --- a/src/net/ea/beinghandler.h +++ b/src/net/ea/beinghandler.h @@ -37,7 +37,7 @@ class BeingHandler notfinal : public Net::BeingHandler explicit BeingHandler(const bool enableSync); static Being *createBeing(const BeingId id, - const int16_t job) A_WARN_UNUSED; + const int job) A_WARN_UNUSED; static void setSprite(Being *const being, const unsigned int slot, const int id, diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp index 9bc79c407..1b566edc7 100644 --- a/src/net/eathena/beinghandler.cpp +++ b/src/net/eathena/beinghandler.cpp @@ -460,7 +460,8 @@ Being *BeingHandler::createBeing2(Net::MessageIn &msg, if (job == 45 && beingType == BeingType::NPC_EVENT) type = ActorType::Portal; - Being *const being = actorManager->createBeing(id, type, job); + Being *const being = actorManager->createBeing( + id, type, fromInt(job, BeingTypeId)); if (beingType == BeingType::MERSOL) { MercenaryInfo *const info = PlayerInfo::getMercenary(); @@ -524,7 +525,7 @@ void BeingHandler::processBeingChangeLookContinue(Net::MessageIn &msg, switch (type) { case 0: // change race - dstBeing->setSubtype(static_cast(id), + dstBeing->setSubtype(fromInt(id, BeingTypeId), dstBeing->getLook()); break; case 1: // eAthena LOOK_HAIR @@ -689,7 +690,7 @@ void BeingHandler::processBeingVisible(Net::MessageIn &msg) speed = 150; dstBeing->setWalkSpeed(Vector(speed, speed, 0)); - dstBeing->setSubtype(job, 0); + dstBeing->setSubtype(fromInt(job, BeingTypeId), 0); if (dstBeing->getType() == ActorType::Monster && localPlayer) localPlayer->checkNewName(dstBeing); @@ -849,7 +850,7 @@ void BeingHandler::processBeingMove(Net::MessageIn &msg) speed = 150; dstBeing->setWalkSpeed(Vector(speed, speed, 0)); - dstBeing->setSubtype(job, 0); + dstBeing->setSubtype(fromInt(job, BeingTypeId), 0); if (dstBeing->getType() == ActorType::Monster && localPlayer) localPlayer->checkNewName(dstBeing); @@ -1019,7 +1020,7 @@ void BeingHandler::processBeingSpawn(Net::MessageIn &msg) speed = 150; dstBeing->setWalkSpeed(Vector(speed, speed, 0)); - dstBeing->setSubtype(job, 0); + dstBeing->setSubtype(fromInt(job, BeingTypeId), 0); if (dstBeing->getType() == ActorType::Monster && localPlayer) localPlayer->checkNewName(dstBeing); @@ -1700,7 +1701,7 @@ void BeingHandler::processBeingFakeName(Net::MessageIn &msg) msg.skip(4, "unsued"); Being *const dstBeing = createBeing2(msg, id, job, type); - dstBeing->setSubtype(job, 0); + dstBeing->setSubtype(fromInt(job, BeingTypeId), 0); dstBeing->setTileCoords(x, y); dstBeing->setDirection(dir); } diff --git a/src/net/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp index f94e3a34f..76005d968 100644 --- a/src/net/eathena/charserverhandler.cpp +++ b/src/net/eathena/charserverhandler.cpp @@ -201,7 +201,7 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg, static_cast(loginHandler)->getToken(); LocalPlayer *const tempPlayer = new LocalPlayer( - msg.readBeingId("player id"), 0); + msg.readBeingId("player id"), BeingTypeId_zero); tempPlayer->setGender(token.sex); PlayerInfoBackend &data = character->data; @@ -252,7 +252,7 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg, color)); const uint16_t look = msg.readInt16("clothes color"); - tempPlayer->setSubtype(race, look); + tempPlayer->setSubtype(fromInt(race, BeingTypeId), look); tempPlayer->setName(msg.readString(24, "name")); character->dummy = tempPlayer; diff --git a/src/net/eathena/pethandler.cpp b/src/net/eathena/pethandler.cpp index 32f902e80..f89a6d53a 100644 --- a/src/net/eathena/pethandler.cpp +++ b/src/net/eathena/pethandler.cpp @@ -166,7 +166,8 @@ void PetHandler::processPetMessage(Net::MessageIn &msg) if (!dstBeing) return; - const int hungry = data - (dstBeing->getSubType() - 100) * 100 - 50; + const int hungry = data - (toInt(dstBeing->getSubType(), int) + - 100) * 100 - 50; if (hungry >= 0 && hungry <= 4) { if (localChatTab && localPlayer) diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp index 0191953a4..451a88ec5 100644 --- a/src/net/tmwa/beinghandler.cpp +++ b/src/net/tmwa/beinghandler.cpp @@ -330,7 +330,7 @@ void BeingHandler::processBeingChangeLookContinue(Net::MessageIn &msg, switch (type) { case 0: // change race - dstBeing->setSubtype(static_cast(id), + dstBeing->setSubtype(fromInt(id, BeingTypeId), dstBeing->getLook()); break; case 1: // eAthena LOOK_HAIR @@ -479,7 +479,7 @@ void BeingHandler::processPlayerUpdate1(Net::MessageIn &msg) const uint8_t hairStyle = msg.readUInt8("hair style"); const uint16_t look = msg.readUInt8("look"); - dstBeing->setSubtype(job, look); + dstBeing->setSubtype(fromInt(job, BeingTypeId), look); const uint16_t weapon = msg.readInt16("weapon"); const uint16_t shield = msg.readInt16("shield"); const uint16_t headBottom = msg.readInt16("head bottom"); @@ -631,7 +631,7 @@ void BeingHandler::processPlayerUpdate2(Net::MessageIn &msg) const uint8_t hairStyle = msg.readUInt8("hair style"); const uint16_t look = msg.readUInt8("look"); - dstBeing->setSubtype(job, look); + dstBeing->setSubtype(fromInt(job, BeingTypeId), look); const uint16_t weapon = msg.readInt16("weapon"); const uint16_t shield = msg.readInt16("shield"); const uint16_t headBottom = msg.readInt16("head bottom"); @@ -779,7 +779,7 @@ void BeingHandler::processPlayerMove(Net::MessageIn &msg) const uint8_t hairStyle = msg.readUInt8("hair style"); const uint16_t look = msg.readUInt8("look"); - dstBeing->setSubtype(job, look); + dstBeing->setSubtype(fromInt(job, BeingTypeId), look); const uint16_t weapon = msg.readInt16("weapon"); const uint16_t shield = msg.readInt16("shield"); const uint16_t headBottom = msg.readInt16("head bottom"); @@ -986,7 +986,7 @@ void BeingHandler::processBeingVisible(Net::MessageIn &msg) const uint8_t hairStyle = msg.readUInt8("hair style"); const uint16_t look = msg.readUInt8("look"); - dstBeing->setSubtype(job, look); + dstBeing->setSubtype(fromInt(job, BeingTypeId), look); if (dstBeing->getType() == ActorType::Monster && localPlayer) localPlayer->checkNewName(dstBeing); dstBeing->setWalkSpeed(Vector(speed, speed, 0)); @@ -1185,7 +1185,7 @@ void BeingHandler::processBeingMove(Net::MessageIn &msg) const uint8_t hairStyle = msg.readUInt8("hair style"); const uint16_t look = msg.readUInt8("look"); - dstBeing->setSubtype(job, look); + dstBeing->setSubtype(fromInt(job, BeingTypeId), look); if (dstBeing->getType() == ActorType::Monster && localPlayer) localPlayer->checkNewName(dstBeing); dstBeing->setWalkSpeed(Vector(speed, speed, 0)); diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp index f3a8ab0c6..0ae7bfc4f 100644 --- a/src/net/tmwa/charserverhandler.cpp +++ b/src/net/tmwa/charserverhandler.cpp @@ -141,7 +141,7 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg, static_cast(loginHandler)->getToken(); LocalPlayer *const tempPlayer = new LocalPlayer( - msg.readBeingId("account id"), 0); + msg.readBeingId("account id"), BeingTypeId_zero); tempPlayer->setGender(token.sex); PlayerInfoBackend &data = character->data; @@ -173,7 +173,7 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg, const uint16_t race = msg.readInt16("class"); const uint8_t hairStyle = msg.readUInt8("hair style"); const uint16_t look = msg.readUInt8("look"); - tempPlayer->setSubtype(race, look); + tempPlayer->setSubtype(fromInt(race, BeingTypeId), look); const uint16_t weapon = msg.readInt16("weapon"); tempPlayer->setSprite(SPRITE_BODY, weapon, "", 1, true); -- cgit v1.2.3-60-g2f50