hedgewars/uGears.pas
changeset 700 be4847674071
parent 698 43f3ef079f53
child 701 8841f71b5e79
equal deleted inserted replaced
699:353382e07407 700:be4847674071
   937     function CountNonZeroz(x, y, r: LongInt): LongInt;
   937     function CountNonZeroz(x, y, r: LongInt): LongInt;
   938     var i: LongInt;
   938     var i: LongInt;
   939         Result: LongInt;
   939         Result: LongInt;
   940     begin
   940     begin
   941     Result:= 0;
   941     Result:= 0;
       
   942 AddFileLog('x, y, test = ' + inttostr(x) + ', ' + inttostr(y) + ' ,' + inttostr(y and $FFFFFC00));
   942     if (y and $FFFFFC00) <> 0 then exit;
   943     if (y and $FFFFFC00) <> 0 then exit;
   943     for i:= max(x - r, 0) to min(x + r, 2043) do
   944     for i:= max(x - r, 0) to min(x + r, 2043) do
   944         if Land[y, i] <> 0 then inc(Result);
   945         if Land[y, i] <> 0 then inc(Result);
       
   946 AddFileLog('CountNonZeroz = ' + inttostr(Result));
   945     CountNonZeroz:= Result
   947     CountNonZeroz:= Result
   946     end;
   948     end;
   947 
   949 
   948 var x: LongInt;
   950 var x: LongInt;
   949     y, sy: LongInt;
   951     y, sy: LongInt;
   963      while y < 1023 do
   965      while y < 1023 do
   964         begin
   966         begin
   965         repeat
   967         repeat
   966           inc(y, 2);
   968           inc(y, 2);
   967         until (y > 1023) or (CountNonZeroz(x, y, Gear^.Radius - 1) = 0);
   969         until (y > 1023) or (CountNonZeroz(x, y, Gear^.Radius - 1) = 0);
   968 AddFileLog('x, sy = ' + inttostr(x) + ', ' + inttostr(y));
       
   969         sy:= y;
   970         sy:= y;
   970         repeat
   971         repeat
   971           inc(y);
   972           inc(y);
   972         until (y > 1023) or (CountNonZeroz(x, y, Gear^.Radius - 1) <> 0);
   973         until (y > 1023) or (CountNonZeroz(x, y, Gear^.Radius - 1) <> 0);
   973         if (y - sy > Gear^.Radius * 2)
   974         if (y - sy > Gear^.Radius * 2)