code: private void avoidObstacle(int nextStep, int max)
      {
          if (nextStep >= max - 1)
          {
              pathStoppedRequested = true;
          }
          final Collection<Integer> cid = mapPath.getObjectsId(path.getX(nextStep), path.getY(nextStep));
          if (sharedPathIds.containsAll(cid))
          {
              setDestination(destX, destY);
          }
          else
          {
              if (!ignoredIds.containsAll(cid))
              {
                  setDestination(destX, destY);
              }
          }
      }
docs: Update to avoid obstacle because next step is not free.
  
  @param nextStep The next step.
  @param max The maximum steps.