summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-10-18 11:06:01 +0000
committerGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-10-18 11:06:01 +0000
commit546ae9ed020aefae6ee7470a92dff4901eceb53f (patch)
treee8af17d68d42c2af6a9055ff3d0dc932ff8f6ba0 /src/net
parent1e949983c13cab920a4cc445b2ed6429dd9aad5a (diff)
downloadmana-546ae9ed020aefae6ee7470a92dff4901eceb53f.tar.gz
mana-546ae9ed020aefae6ee7470a92dff4901eceb53f.tar.bz2
mana-546ae9ed020aefae6ee7470a92dff4901eceb53f.tar.xz
mana-546ae9ed020aefae6ee7470a92dff4901eceb53f.zip
Removed guess of being type from class number. Factored handler for new beings.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/beinghandler.cpp41
1 files changed, 15 insertions, 26 deletions
diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp
index b88d443e..020d24af 100644
--- a/src/net/beinghandler.cpp
+++ b/src/net/beinghandler.cpp
@@ -449,18 +449,18 @@ static void handleLooks(Being *being, MessageIn &msg)
void
BeingHandler::handleBeingEnterMessage(MessageIn &msg)
{
- int type = msg.readByte(); // type
+ int type = msg.readByte();
int id = msg.readShort();
Being::Action action = (Being::Action)msg.readByte();
- Uint16 px = msg.readShort();
- Uint16 py = msg.readShort();
+ int px = msg.readShort();
+ int py = msg.readShort();
+ Being *being;
switch (type)
{
case OBJECT_PLAYER:
{
std::string name = msg.readString();
- Being *being;
if (player_node->getName() == name)
{
being = player_node;
@@ -468,41 +468,30 @@ BeingHandler::handleBeingEnterMessage(MessageIn &msg)
}
else
{
- being = beingManager->createBeing(id, 0);
+ being = beingManager->createBeing(id, type, 0);
being->setName(name);
}
being->setHairStyle(msg.readByte());
being->setHairColor(msg.readByte());
being->setSex(msg.readByte());
- being->mX = px;
- being->mY = py;
- being->setDestination(px, py);
- being->setAction(action);
handleLooks(being, msg);
} break;
case OBJECT_MONSTER:
- {
- int monsterId = msg.readShort();
- Being *being;
- being = beingManager->createBeing(id, monsterId);
- being->mX = px;
- being->mY = py;
- being->setDestination(px, py);
- being->setAction(action);
- } break;
-
case OBJECT_NPC:
{
- int npcId = msg.readShort();
- Being *being;
- being = beingManager->createBeing(id, npcId);
- being->mX = px;
- being->mY = py;
- being->setDestination(px, py);
- being->setAction(action);
+ int subtype = msg.readShort();
+ being = beingManager->createBeing(id, type, subtype);
} break;
+
+ default:
+ return;
}
+
+ being->mX = px;
+ being->mY = py;
+ being->setDestination(px, py);
+ being->setAction(action);
}
void BeingHandler::handleBeingLeaveMessage(MessageIn &msg)