Auto-translated
By the way, if he gets stuck on another monster, some hero, or in a town garrison, that won't be good either, so it's ideal to check those cases as well (I'm not sure if IsTilePassable takes this into account, but probably not).