From 982dc85b60d5dff796ab87de052279350d5e1450 Mon Sep 17 00:00:00 2001 From: mekolat Date: Wed, 13 Apr 2016 14:17:33 -0400 Subject: do not send BEING_REMOVE when the npc is already removed --- src/map/npc.cpp | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'src/map/npc.cpp') diff --git a/src/map/npc.cpp b/src/map/npc.cpp index 5b0ee7b..47bf820 100644 --- a/src/map/npc.cpp +++ b/src/map/npc.cpp @@ -121,27 +121,26 @@ int npc_enable(NpcName name, bool flag) { // 有効化 nd->flag &= ~1; clif_spawnnpc(nd); + int xs = 0, ys = 0; + if (dumb_ptr nd_ = nd->is_script()) + { + xs = nd_->scr.xs; + ys = nd_->scr.ys; + } + + if (flag && (xs > 0 || ys > 0)) + map_foreachinarea(std::bind(npc_enable_sub, ph::_1, nd), + nd->bl_m, + nd->bl_x - xs, nd->bl_y - ys, + nd->bl_x + xs, nd->bl_y + ys, + BL::PC); } - else + else if (!(nd->flag & 1)) { // 無効化 - nd->flag |= 1; clif_clearchar(nd, BeingRemoveWhy::GONE); + nd->flag |= 1; } - int xs = 0, ys = 0; - if (dumb_ptr nd_ = nd->is_script()) - { - xs = nd_->scr.xs; - ys = nd_->scr.ys; - } - - if (flag && (xs > 0 || ys > 0)) - map_foreachinarea(std::bind(npc_enable_sub, ph::_1, nd), - nd->bl_m, - nd->bl_x - xs, nd->bl_y - ys, - nd->bl_x + xs, nd->bl_y + ys, - BL::PC); - return 0; } -- cgit v1.2.3-60-g2f50