diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2006-08-27 22:49:10 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2006-08-27 22:49:10 +0000 |
commit | af61e1e7df91b97c3f7516e9eb2b37b621f069ad (patch) | |
tree | 3123d2a6aed02c0c2938606bb99f087dd07836f1 /src/net/beinghandler.cpp | |
parent | 6f6d061b23c6c70c632fb3ec6aa3735325f701e0 (diff) | |
download | mana-af61e1e7df91b97c3f7516e9eb2b37b621f069ad.tar.gz mana-af61e1e7df91b97c3f7516e9eb2b37b621f069ad.tar.bz2 mana-af61e1e7df91b97c3f7516e9eb2b37b621f069ad.tar.xz mana-af61e1e7df91b97c3f7516e9eb2b37b621f069ad.zip |
Added support for entering monsters.
Diffstat (limited to 'src/net/beinghandler.cpp')
-rw-r--r-- | src/net/beinghandler.cpp | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp index 59a4fa9a..e3eb6eba 100644 --- a/src/net/beinghandler.cpp +++ b/src/net/beinghandler.cpp @@ -397,24 +397,36 @@ void BeingHandler::handleMessage(MessageIn &msg) void BeingHandler::handleBeingEnterMessage(MessageIn &msg) { - msg.readByte(); // type + int type = msg.readByte(); // type int id = msg.readLong(); - std::string name = msg.readString(); - Being *being; - if (player_node->getName() == name) + + switch (type) { + case OBJECT_PLAYER: { - being = player_node; - being->setId(id); - } - else + std::string name = msg.readString(); + Being *being; + if (player_node->getName() == name) + { + being = player_node; + being->setId(id); + } + else + { + being = beingManager->createBeing(id, 0); + being->setName(name); + } + being->setHairStyle(msg.readByte()); + being->setHairColor(msg.readByte()); + being->setSex(msg.readByte()); + } break; + case OBJECT_MONSTER: { - // assume type is player for now, so job 0, TODO - being = beingManager->createBeing(id, 0); - being->setName(name); + int monsterId = msg.readShort(); + Being *being; + being = beingManager->createBeing(id, 1002 + monsterId); + being->setWalkSpeed(150); // TODO + } break; } - being->setHairStyle(msg.readByte()); - being->setHairColor(msg.readByte()); - being->setSex(msg.readByte()); } void BeingHandler::handleBeingLeaveMessage(MessageIn &msg) |