anchor.diff:  var
     I, K: Word;
     I1, I2, K1, K2: Word;
  -begin
  +  SqrRadius: Integer;
  +begin
  +  if not CoverHasBeenCalled then
  +  begin
  +    if RevealedRadius[Pos.Y, Pos.X] >= Radius then Exit;
  +    RevealedRadius[Pos.Y, Pos.X] := Radius;
  +  end;
  +
     //Avoid repeated computing (+2% performance)
     I1 := max(Pos.Y-Radius, 0);
     I2 := min(Pos.Y+Radius, MapY-1);
     K1 := max(Pos.X-Radius, 0);
     K2 := min(Pos.X+Radius, MapX-1);
  +  SqrRadius := sqr(Radius);
   
     //Inline maths here to gain performance
  -  for I := I1 to I2 do for K := K1 to K2 do
  -  if (sqr(Pos.X - K) + sqr(Pos.Y - I)) <= sqr(Radius) then
  -    Revelation[I, K] := min(Revelation[I, K] + Amount, FOG_OF_WAR_MAX);
  +  if Amount >= FOG_OF_WAR_MAX then
  +  begin
  +    for I := I1 to I2 do for K := K1 to K2 do
  +    if (sqr(Pos.X - K) + sqr(Pos.Y - I)) <= SqrRadius then
  +      Revelation[I, K] := FOG_OF_WAR_MAX;
  +  end
  +  else
  +  begin
  +    for I := I1 to I2 do for K := K1 to K2 do
  +    if (sqr(Pos.X - K) + sqr(Pos.Y - I)) <= SqrRadius then
  +      Revelation[I, K] := min(Revelation[I, K] + Amount, FOG_OF_WAR_MAX);
  +  end;
   end;
   
   
  
positive.code: begin
    for I := TL.Y to BR.Y do for K := TL.X to BR.X do
      Revelation[I,K] := 0;
  end;
  
  
  
negative.code: 
  
  implementation
  
  
  { TKMFogOfWar }
  