summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormekolat <mekolat@users.noreply.github.com>2016-04-13 14:17:33 -0400
committermekolat <mekolat@users.noreply.github.com>2016-04-15 11:47:34 -0400
commit982dc85b60d5dff796ab87de052279350d5e1450 (patch)
tree8b42ed5c618b1a7d9815fee835e6ae89291ef854
parent636f0212bd2ea7f0f55d2859fcbea9f91d633903 (diff)
downloadtmwa-982dc85b60d5dff796ab87de052279350d5e1450.tar.gz
tmwa-982dc85b60d5dff796ab87de052279350d5e1450.tar.bz2
tmwa-982dc85b60d5dff796ab87de052279350d5e1450.tar.xz
tmwa-982dc85b60d5dff796ab87de052279350d5e1450.zip
do not send BEING_REMOVE when the npc is already removed
-rw-r--r--src/map/npc.cpp31
1 files changed, 15 insertions, 16 deletions
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<npc_data_script> 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<npc_data_script> 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;
}