summaryrefslogtreecommitdiff
path: root/src/map/unit.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/unit.c')
-rw-r--r--src/map/unit.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/map/unit.c b/src/map/unit.c
index 148a35782..e901d3138 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -325,7 +325,8 @@ int unit_walktoxy( struct block_list *bl, short x, short y, int flag)
if( ud == NULL) return 0;
#ifdef OFFICIAL_WALKPATH
- if( path_search(&wpd, bl->m, bl->x, bl->y, x, y, flag&1, CELL_CHKNOPASS) // Check if there is an obstacle between
+ path_search(&wpd, bl->m, bl->x, bl->y, x, y, flag&1, CELL_CHKNOPASS); // Count walk path cells
+ if( !path_search_long(NULL, bl->m, bl->x, bl->y, x, y, CELL_CHKNOPASS) // Check if there is an obstacle between
&& wpd.path_len > 14 ) // Official number of walkable cells is 14 if and only if there is an obstacle between. [malufett]
return 0;
#endif
@@ -350,7 +351,7 @@ int unit_walktoxy( struct block_list *bl, short x, short y, int flag)
map_random_dir(bl, &ud->to_x, &ud->to_y);
if(ud->walktimer != INVALID_TIMER) {
- if( !battle_config.skill_trap_type && sc->data[SC_ANKLE] ) // Ankle disallows you from changing your path
+ if( !battle_config.skill_trap_type && sc && sc->data[SC_ANKLE] ) // Ankle disallows you from changing your path
return 0;
// When you come to the center of the grid because the change of destination while you're walking right now
// Call a function from a timer unit_walktoxy_sub
@@ -427,7 +428,7 @@ int unit_walktobl(struct block_list *bl, struct block_list *tbl, int range, int
map_random_dir(bl, &ud->to_x, &ud->to_y);
if(ud->walktimer != INVALID_TIMER) {
- if( !battle_config.skill_trap_type && sc->data[SC_ANKLE] ) // Ankle disallows you from changing your path
+ if( !battle_config.skill_trap_type && sc && sc->data[SC_ANKLE] ) // Ankle disallows you from changing your path
return 0;
ud->state.change_walk_target = 1;
set_mobstate(bl, flag&2);
@@ -938,7 +939,7 @@ int unit_can_move(struct block_list *bl) {
if( sc->data[SC_ANKLE] && ( battle_config.skill_trap_type || !unit_is_walking(bl) ) ) // Ankle only stops you after you're done moving
return 0;
- if (sc->opt1 > 0 && sc->opt1 != OPT1_STONEWAIT && sc->opt1 != OPT1_BURNING && (sc->opt1 != OPT1_CRYSTALIZE && bl->type != BL_MOB))
+ if (sc->opt1 > 0 && sc->opt1 != OPT1_STONEWAIT && sc->opt1 != OPT1_BURNING && !(sc->opt1 == OPT1_CRYSTALIZE && bl->type == BL_MOB))
return 0;
if ((sc->option & OPTION_HIDE) && (!sd || pc_checkskill(sd, RG_TUNNELDRIVE) <= 0))