summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorWushin <pasekei@gmail.com>2015-08-16 14:02:46 -0500
committerWushin <pasekei@gmail.com>2015-08-16 14:02:46 -0500
commit22cec0e1a4eb7476028b7b230ac30bb83e5bea27 (patch)
tree868286b24a09e45df7f125891b5d6ab23509c749 /src/map
parent1ecb7f8ed0091ecf5d63815006ca3e80ef6cfd97 (diff)
parent089c984ee7270fbfebdb3a8448d75495f0adfe9c (diff)
downloadtmwa-22cec0e1a4eb7476028b7b230ac30bb83e5bea27.tar.gz
tmwa-22cec0e1a4eb7476028b7b230ac30bb83e5bea27.tar.bz2
tmwa-22cec0e1a4eb7476028b7b230ac30bb83e5bea27.tar.xz
tmwa-22cec0e1a4eb7476028b7b230ac30bb83e5bea27.zip
Merge pull request #130 from mekolat/0x007b
Stop sending 0x007b to new clients for mob movement REDUX
Diffstat (limited to 'src/map')
-rw-r--r--src/map/clif.cpp47
1 files changed, 32 insertions, 15 deletions
diff --git a/src/map/clif.cpp b/src/map/clif.cpp
index 35cc463..49089d7 100644
--- a/src/map/clif.cpp
+++ b/src/map/clif.cpp
@@ -857,7 +857,7 @@ void clif_mob007b(dumb_ptr<mob_data> md, Buffer& buf)
*------------------------------------------
*/
static
-int clif_0225_being_move3(dumb_ptr<mob_data> md)
+int clif_0225_being_move3(dumb_ptr<mob_data> md, Buffer& buf)
{
Packet_Head<0x0225> head_225;
std::vector<Packet_Repeat<0x0225>> repeat_225;
@@ -874,10 +874,7 @@ int clif_0225_being_move3(dumb_ptr<mob_data> md)
repeat_225.push_back(move_225);
}
- Buffer buf = create_vpacket<0x0225, 14, 1>(head_225, repeat_225);
-
- clif_send(buf, md, SendWho::AREA, 3);
-
+ buf = create_vpacket<0x0225, 14, 1>(head_225, repeat_225);
return 0;
}
/*==========================================
@@ -2436,14 +2433,38 @@ void clif_getareachar_npc(dumb_ptr<map_session_data> sd, dumb_ptr<npc_data> nd)
* 移動停止
*------------------------------------------
*/
+
+static
+void clif_movemob_sub(dumb_ptr<block_list> sd_bl, dumb_ptr<mob_data> md)
+{
+ nullpo_retv(sd_bl);
+ nullpo_retv(md);
+ dumb_ptr<map_session_data> sd = sd_bl->is_player();
+ Buffer buf;
+
+ if (sd->client_version < 3 || sd->client_version >= 4)
+ clif_mob007b(md, buf); // backward compatibility for old clients
+ else
+ {
+ Buffer buf2;
+ clif_mob0078(md, buf2);
+ clif_send(buf2, sd, SendWho::SELF, MIN_CLIENT_VERSION);
+
+ clif_0225_being_move3(md, buf);
+ }
+
+ clif_send(buf, sd, SendWho::SELF, MIN_CLIENT_VERSION);
+}
+
int clif_movemob(dumb_ptr<mob_data> md)
{
nullpo_retz(md);
- Buffer buf;
- clif_mob007b(md, buf);
- clif_send(buf, md, SendWho::AREA, MIN_CLIENT_VERSION);
- clif_0225_being_move3(md);
+ map_foreachinarea(std::bind(clif_movemob_sub, ph::_1, md),
+ md->bl_m,
+ md->bl_x - AREA_SIZE, md->bl_y - AREA_SIZE,
+ md->bl_x + AREA_SIZE, md->bl_y + AREA_SIZE,
+ BL::PC);
return 0;
}
@@ -2458,9 +2479,7 @@ int clif_fixmobpos(dumb_ptr<mob_data> md)
if (md->state.state == MS::WALK)
{
- Buffer buf;
- clif_mob007b(md, buf);
- clif_send(buf, md, SendWho::AREA, MIN_CLIENT_VERSION);
+ clif_movemob(md);
}
else
{
@@ -2540,9 +2559,7 @@ void clif_getareachar_mob(dumb_ptr<map_session_data> sd, dumb_ptr<mob_data> md)
if (md->state.state == MS::WALK)
{
- Buffer buf;
- clif_mob007b(md, buf);
- send_buffer(sd->sess, buf);
+ clif_movemob_sub(sd, md);
}
else
{