471 |
471 |
472 function CountNonZeroz(x, y, r, c: LongInt): LongInt; |
472 function CountNonZeroz(x, y, r, c: LongInt): LongInt; |
473 var i: LongInt; |
473 var i: LongInt; |
474 count: LongInt = 0; |
474 count: LongInt = 0; |
475 begin |
475 begin |
476 if (y and LAND_HEIGHT_MASK) = 0 then |
476 if (y and LAND_HEIGHT_MASK) = 0 then |
477 for i:= max(x - r, 0) to min(x + r, LAND_WIDTH - 4) do |
477 for i:= max(x - r, 0) to min(x + r, LAND_WIDTH - 4) do |
478 if Land[y, i] <> 0 then |
478 if Land[y, i] <> 0 then |
479 begin |
479 begin |
480 inc(count); |
480 inc(count); |
481 if count = c then |
481 if count = c then |
482 exit(count) |
482 begin |
|
483 CountNonZeroz:= count; |
|
484 exit |
|
485 end; |
483 end; |
486 end; |
484 CountNonZeroz:= count; |
487 CountNonZeroz:= count; |
485 end; |
488 end; |
486 |
489 |
487 |
490 |
488 function NoGearsToAvoid(mX, mY: LongInt; rX, rY: LongInt): boolean; |
491 function NoGearsToAvoid(mX, mY: LongInt; rX, rY: LongInt): boolean; |
489 var t: PGear; |
492 var t: PGear; |
490 begin |
493 begin |
|
494 NoGearsToAvoid:= false; |
491 t:= GearsList; |
495 t:= GearsList; |
492 rX:= sqr(rX); |
496 rX:= sqr(rX); |
493 rY:= sqr(rY); |
497 rY:= sqr(rY); |
494 while t <> nil do |
498 while t <> nil do |
495 begin |
499 begin |
496 if t^.Kind <= gtExplosives then |
500 if t^.Kind <= gtExplosives then |
497 if not (hwSqr(int2hwFloat(mX) - t^.X) / rX + hwSqr(int2hwFloat(mY) - t^.Y) / rY > _1) then |
501 if not (hwSqr(int2hwFloat(mX) - t^.X) / rX + hwSqr(int2hwFloat(mY) - t^.Y) / rY > _1) then |
498 exit(false); |
502 exit; |
499 t:= t^.NextGear |
503 t:= t^.NextGear |
500 end; |
504 end; |
501 NoGearsToAvoid:= true |
505 NoGearsToAvoid:= true |
502 end; |
506 end; |
503 |
507 |