| 680 | } |
| 681 | |
| 682 | void |
| 683 | selection_do_randline( |
| 684 | coordxy x1, coordxy y1, |
| 685 | coordxy x2, coordxy y2, |
| 686 | schar rough, |
| 687 | schar rec, |
| 688 | struct selectionvar *ov) |
| 689 | { |
| 690 | int mx, my; |
| 691 | int dx, dy; |
| 692 | |
| 693 | if (rec < 1 || (x2 == x1 && y2 == y1)) |
| 694 | return; |
| 695 | |
| 696 | if (rough > max(abs(x2 - x1), abs(y2 - y1))) |
| 697 | rough = max(abs(x2 - x1), abs(y2 - y1)); |
| 698 | |
| 699 | if (rough < 2) { |
| 700 | mx = ((x1 + x2) / 2); |
| 701 | my = ((y1 + y2) / 2); |
| 702 | } else { |
| 703 | do { |
| 704 | dx = rn2(rough) - (rough / 2); |
| 705 | dy = rn2(rough) - (rough / 2); |
| 706 | mx = ((x1 + x2) / 2) + dx; |
| 707 | my = ((y1 + y2) / 2) + dy; |
| 708 | } while ((mx > COLNO - 1 || mx < 0 || my < 0 || my > ROWNO - 1)); |
| 709 | } |
| 710 | |
| 711 | if (!selection_getpoint(mx, my, ov)) { |
| 712 | selection_setpoint(mx, my, ov, 1); |
| 713 | } |
| 714 | |
| 715 | rough = (rough * 2) / 3; |
| 716 | |
| 717 | rec--; |
| 718 | |
| 719 | selection_do_randline(x1, y1, mx, my, rough, rec, ov); |
| 720 | selection_do_randline(mx, my, x2, y2, rough, rec, ov); |
| 721 | |
| 722 | selection_setpoint(x2, y2, ov, 1); |
| 723 | } |
| 724 | |
| 725 | void |
| 726 | selection_iterate( |
no test coverage detected