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/eathena/beinghandler.cpp | 13 +++++++------ src/net/eathena/charserverhandler.cpp | 4 ++-- src/net/eathena/pethandler.cpp | 3 ++- 3 files changed, 11 insertions(+), 9 deletions(-) (limited to 'src/net/eathena') 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) -- cgit v1.2.3-70-g09d2