anchor.diff:        end;
         if (Y < Shape[X].Min) then
           Shape[X].Min := Y;
  -      if (Y < gTerrain.MapY-1) then MinerFixFloodSearch(Y+1,X);
  +      if (Y < fMapY-1) then MinerFixFloodSearch(Y+1,X);
         if (Y > 1)               then MinerFixFloodSearch(Y-1,X);
  -      if (X < gTerrain.MapX-1) then MinerFixFloodSearch(Y,X+1);
  +      if (X < fMapX-1) then MinerFixFloodSearch(Y,X+1);
         if (X > 1)               then MinerFixFloodSearch(Y,X-1);
       end;
     end;
  
positive.code:     X,aX,X0,X1,X2,Y,aY,Y0,Y1,Y2,i,idxX,idxY,move,price: Integer;
      History: TInteger2Array;
  begin
    SetLength(Result, gTerrain.MapY+1, gTerrain.MapX+1);
    SetLength(History, gTerrain.MapY+1, gTerrain.MapX+1);
    SetLength(Points, RoundUP((gTerrain.MapY-1) / (Step*1.0)), RoundUP((gTerrain.MapX-1) / (Step*1.0)));
    for Y := Low(Result) to High(Result) do
      for X := Low(Result[Y]) to High(Result[Y]) do
      begin
  
negative.code:   PathArr: TInteger2Array;
    FillObject: TKMFillObject;
  begin
    SetLength(PathArr, fMapY, fMapX);
    for Y1 := Low(PathArr) to High(PathArr) do
    	for X1 := High(PathArr[Y1]) to High(PathArr[Y1]) do
    		PathArr[Y1,X1] := 0;
  
    // Walk from Locs everywhere (if it is possible)
    FillObject := TKMFillObject.Create(KMPoint(1,1), KMPoint(fMapX-1, fMapY-1), PathArr, TilesPartsArr.Obj, TilesPartsArr.Terrain, False);
    try
      for i := Low(Locs) to High(Locs) do
      begin
  