diff --git a/src/map/map.c b/src/map/map.c index b60a7db09ee..1f7ad12ca90 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -3242,14 +3242,18 @@ static int map_getcellp(struct map_data *m, const struct block_list *bl, int16 x // special checks case CELL_CHKPASS: #ifdef CELL_NOSTACK - if (cell.cell_bl >= battle_config.custom_cell_stack_limit) return 0; + if (cell.cell_bl >= battle_config.custom_cell_stack_limit) + return 0; + FALLTHROUGH #endif case CELL_CHKREACH: return (cell.walkable); case CELL_CHKNOPASS: #ifdef CELL_NOSTACK - if (cell.cell_bl >= battle_config.custom_cell_stack_limit) return 1; + if (cell.cell_bl >= battle_config.custom_cell_stack_limit) + return 1; + FALLTHROUGH #endif case CELL_CHKNOREACH: return (!cell.walkable); diff --git a/src/map/mob.c b/src/map/mob.c index f36bc37c89b..9f97c062469 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -1327,7 +1327,14 @@ static int mob_ai_sub_hard_activesearch(struct block_list *bl, va_list ap) #ifdef ACTIVEPATHSEARCH struct walkpath_data wpd; bool is_standing = (md->ud.walktimer == INVALID_TIMER); +#ifdef CELL_NOSTACK + // Do not count target's cell + short x, y; + if ((unit->can_reach_bl(&md->bl, bl, distance_bl(&md->bl, bl) + 1, 1, &x, &y) + && !path->search(&wpd, &md->bl, md->bl.m, md->bl.x, md->bl.y, x, y, 0, CELL_CHKNOPASS)) // Count walk path cells +#else if (!path->search(&wpd, &md->bl, md->bl.m, md->bl.x, md->bl.y, bl->x, bl->y, 0, CELL_CHKNOPASS) // Count walk path cells +#endif || (is_standing && wpd.path_len > md->db->range2) //Standing monsters use range2, walking monsters use range3 || (!is_standing && wpd.path_len > md->db->range3)) { if (!check_distance_bl(&md->bl, bl, md->status.rhw.range)