summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/map/unit.c42
1 files changed, 16 insertions, 26 deletions
diff --git a/src/map/unit.c b/src/map/unit.c
index e2735fdc8..339f0a988 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -686,8 +686,7 @@ uint8 unit_getdir(struct block_list *bl)
// &1 Do not send position update packets.
int unit_blown(struct block_list* bl, int dx, int dy, int count, int flag)
{
- if(count)
- {
+ if(count) {
struct map_session_data* sd;
struct skill_unit* su = NULL;
int nx, ny, result;
@@ -700,49 +699,40 @@ int unit_blown(struct block_list* bl, int dx, int dy, int count, int flag)
nx = result>>16;
ny = result&0xffff;
- if(!su)
- {
+ if(!su) {
unit_stop_walking(bl, 0);
}
-
- sd->ud.to_x = nx;
- sd->ud.to_y = ny;
-
+
+ if( sd ) {
+ sd->ud.to_x = nx;
+ sd->ud.to_y = ny;
+ }
+
dx = nx-bl->x;
dy = ny-bl->y;
- if(dx || dy)
- {
+ if(dx || dy) {
map_foreachinmovearea(clif_outsight, bl, AREA_SIZE, dx, dy, bl->type == BL_PC ? BL_ALL : BL_PC, bl);
- if(su)
- {
+ if(su) {
skill_unit_move_unit_group(su->group, bl->m, dx, dy);
- }
- else
- {
+ } else {
map_moveblock(bl, nx, ny, gettick());
}
map_foreachinmovearea(clif_insight, bl, AREA_SIZE, -dx, -dy, bl->type == BL_PC ? BL_ALL : BL_PC, bl);
- if(!(flag&1))
- {
+ if(!(flag&1)) {
clif_blown(bl);
}
- if(sd)
- {
- if(sd->touching_id)
- {
+ if(sd) {
+ if(sd->touching_id) {
npc_touchnext_areanpc(sd, false);
}
- if(map_getcell(bl->m, bl->x, bl->y, CELL_CHKNPC))
- {
+ if(map_getcell(bl->m, bl->x, bl->y, CELL_CHKNPC)) {
npc_touch_areanpc(sd, bl->m, bl->x, bl->y);
- }
- else
- {
+ } else {
sd->areanpc_id = 0;
}
}