diff options
Diffstat (limited to 'src/map/clif.cpp')
-rw-r--r-- | src/map/clif.cpp | 63 |
1 files changed, 33 insertions, 30 deletions
diff --git a/src/map/clif.cpp b/src/map/clif.cpp index 0ae8fbe..57c9dcb 100644 --- a/src/map/clif.cpp +++ b/src/map/clif.cpp @@ -305,16 +305,19 @@ int clif_send(const Buffer& buf, dumb_ptr<block_list> bl, SendWho type, ClientVe } break; case SendWho::ALL_SAMEMAP: // 同じマップの全クライアントに送信 - for (io::FD i : iter_fds()) + if (bl->bl_m != borrow(undefined_gat)) { - Session *s = get_session(i); - if (!s) - continue; - dumb_ptr<map_session_data> sd = dumb_ptr<map_session_data>(static_cast<map_session_data *>(s->session_data.get())); - if (sd && sd->state.auth && !sd->state.connect_new && sd->bl_m == bl->bl_m) + for (io::FD i : iter_fds()) { + Session *s = get_session(i); + if (!s) + continue; + dumb_ptr<map_session_data> sd = dumb_ptr<map_session_data>(static_cast<map_session_data *>(s->session_data.get())); + if (sd && sd->state.auth && !sd->state.connect_new && sd->bl_m == bl->bl_m) { - send_buffer(s, buf); + { + send_buffer(s, buf); + } } } } @@ -3806,7 +3809,8 @@ static void clif_message_sub(Buffer& buf, dumb_ptr<block_list> bl, AString msg) { VString<23> name = battle_get_name(bl); - msg = STRPRINTF("%s : %s"_fmt, name, msg); + if (name.size() >= 4) // client limitation + msg = STRPRINTF("%s : %s"_fmt, name, msg); size_t msg_len = msg.size() + 1; if (msg_len + 16 > 512) return; @@ -5810,37 +5814,36 @@ void clif_parse(Session *s) // dispatches to actual function // if error, close socket - dumb_ptr<map_session_data> sd = dumb_ptr<map_session_data>(static_cast<map_session_data *>(s->session_data.get())); + uint16_t packet_id; + RecvResult rv = RecvResult::Complete; + dumb_ptr<map_session_data> sd; - if (!sd || (sd && !sd->state.auth)) + while (rv == RecvResult::Complete && packet_peek_id(s, &packet_id)) { - uint16_t packet_id; - if (!packet_peek_id(s, &packet_id)) - return; + sd = dumb_ptr<map_session_data>(static_cast<map_session_data *>(s->session_data.get())); + + if (!sd || (sd && !sd->state.auth)) + { + if (packet_id != 0x0072 && packet_id != 0x7530) + { + // first packet must be auth or finger + s->set_eof(); + return; + } + } - if (packet_id != 0x0072 && packet_id != 0x7530) + if (!chrif_isconnect()) { - // first packet must be auth or finger s->set_eof(); return; } - } - if (!chrif_isconnect()) - { - s->set_eof(); - return; - } - if (sd && sd->state.auth == 1 && sd->state.waitingdisconnect == 1) - { - packet_discard(s, packet_avail(s)); - return; - } + if (sd && sd->state.auth == 1 && sd->state.waitingdisconnect == 1) + { + packet_discard(s, packet_avail(s)); + return; + } - uint16_t packet_id; - RecvResult rv = RecvResult::Complete; - while (rv == RecvResult::Complete && packet_peek_id(s, &packet_id)) - { switch (packet_id) { case 0x7530: |