summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-04 23:34:40 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-06 01:18:57 +0300
commit0aa42c773981f5f99e1fcd394725cd9da1e42fc1 (patch)
tree498efad82d0e0e230b081803851a173bc5053f7d /src/net
parent523a532a746ba8ae51d1380ef9a29bcdc7ec3136 (diff)
downloadmanaplus-0aa42c773981f5f99e1fcd394725cd9da1e42fc1.tar.gz
manaplus-0aa42c773981f5f99e1fcd394725cd9da1e42fc1.tar.bz2
manaplus-0aa42c773981f5f99e1fcd394725cd9da1e42fc1.tar.xz
manaplus-0aa42c773981f5f99e1fcd394725cd9da1e42fc1.zip
eathena: fix packet SMSG_BEING_SPAWN 0x0858.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/eathena/beinghandler.cpp29
-rw-r--r--src/net/eathena/protocol.h2
2 files changed, 19 insertions, 12 deletions
diff --git a/src/net/eathena/beinghandler.cpp b/src/net/eathena/beinghandler.cpp
index 0593871c7..1d75bbe62 100644
--- a/src/net/eathena/beinghandler.cpp
+++ b/src/net/eathena/beinghandler.cpp
@@ -108,8 +108,9 @@ void BeingHandler::handleMessage(Net::MessageIn &msg)
{
switch (msg.getId())
{
- case SMSG_BEING_VISIBLE: // changed
+ case SMSG_BEING_VISIBLE:
case SMSG_BEING_MOVE:
+ case SMSG_BEING_SPAWN:
processBeingVisibleOrMove(msg);
break;
@@ -117,10 +118,6 @@ void BeingHandler::handleMessage(Net::MessageIn &msg)
processBeingMove2(msg);
break;
- case SMSG_BEING_SPAWN: // changed
- processBeingSpawn(msg);
- break;
-
case SMSG_BEING_REMOVE:
processBeingRemove(msg);
break;
@@ -637,6 +634,7 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg)
return;
const bool visible = msg.getId() == SMSG_BEING_VISIBLE;
+ const bool spawn = msg.getId() == SMSG_BEING_SPAWN;
msg.readInt16("len");
msg.readUInt8("object type");
@@ -644,11 +642,19 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg)
// Information about a being in range
const int id = msg.readInt32("being id");
int spawnId;
- if (id == mSpawnId)
- spawnId = mSpawnId;
+ if (spawn)
+ {
+ mSpawnId = id;
+ spawnId = id;
+ }
else
- spawnId = 0;
- mSpawnId = 0;
+ {
+ if (id == mSpawnId)
+ spawnId = mSpawnId;
+ else
+ spawnId = 0;
+ mSpawnId = 0;
+ }
int16_t speed = msg.readInt16("speed");
// if (visible)
// {
@@ -784,7 +790,7 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg)
}
}
- if (!visible)
+ if (!visible && !spawn)
{
uint16_t srcX, srcY, dstX, dstY;
msg.readCoordinatePair(srcX, srcY, dstX, dstY, "move path");
@@ -801,7 +807,8 @@ void BeingHandler::processBeingVisibleOrMove(Net::MessageIn &msg)
msg.readCoordinates(x, y, dir, "position");
msg.readInt8("xs");
msg.readInt8("ys");
- msg.readUInt8("action type");
+ if (visible)
+ msg.readUInt8("action type");
dstBeing->setTileCoords(x, y);
if (job == 45 && socialWindow && outfitWindow)
diff --git a/src/net/eathena/protocol.h b/src/net/eathena/protocol.h
index c01feb0c4..c2bd36027 100644
--- a/src/net/eathena/protocol.h
+++ b/src/net/eathena/protocol.h
@@ -88,7 +88,7 @@
#define SMSG_ITEM_REMOVE 0x00a1 /**< An item disappers */
#define SMSG_BEING_VISIBLE 0x0857
#define SMSG_BEING_MOVE 0x0856 /**< A nearby monster moves */
-#define SMSG_BEING_SPAWN 0x007c /**< A being spawns nearby */
+#define SMSG_BEING_SPAWN 0x0858 /**< A being spawns nearby */
#define SMSG_BEING_MOVE2 0x0086 /**< New eAthena being moves */
#define SMSG_BEING_REMOVE 0x0080
#define SMSG_BEING_CHANGE_LOOKS 0x00c3