anchor.diff:  
   
   procedure TKMInfluences.AfterMissionInit();
  -  //procedure InitAreas();
  -  //const
  -  //  RAD = 6;
  -  //var
  -  //  cnt: Word;
  -  //  X,Y, X0,Y0: Integer;
  -  //begin
  -  //  for Y := 1 to fMapY - 1 do
  -  //  for X := 1 to fMapX - 1 do
  -  //  begin
  -  //    cnt := 0;
  -  //    for Y0 := Max(1, Y - RAD) to Min(Y + RAD, fMapY - 1) do
  -  //    for X0 := Max(1, X - RAD) to Min(X + RAD, fMapX - 1) do
  -  //      cnt := cnt + Byte(  gRes.Tileset.TileIsWalkable( gTerrain.Land[Y0, X0].Terrain )  );
  -  //    fAreas[Y,X] := Min(255,cnt) * Byte(  gRes.Tileset.TileIsWalkable( gTerrain.Land[Y, X].Terrain )  );
  -  //    fAreas[Y,X] := Min(255,cnt) * Byte(  gRes.Tileset.TileIsWalkable( gTerrain.Land[Y, X].Terrain )  );
  -  //  end;
  -  //end;
  -  procedure InitAreas();
  -  const
  -    RAD = 6;
  -    MAX_ELEMENTS = (RAD+1) * (RAD+1) * 4;
  -    //MAX_ELEMENTS = (RAD*2+1) * (RAD*2+1);
  -    COEF = Round(255 / MAX_ELEMENTS - 0.5);
  -  var
  -    X,Y, X0,Y0, cnt: Integer;
  -  begin
  -    for Y := 1 to fMapY - 1 do
  -    for X := 1 to fMapX - 1 do
  -    begin
  -      //cnt := 0;
  -      cnt := MAX_ELEMENTS;
  -      for Y0 := Max(1, Y - RAD) to Min(Y + RAD, fMapY - 1) do
  -      for X0 := Max(1, X - RAD) to Min(X + RAD, fMapX - 1) do
  -        //cnt := cnt + Byte(  not gRes.Tileset.TileIsWalkable( gTerrain.Land[Y0, X0].Terrain )  );
  -        cnt := cnt - Byte(  not gTerrain.TileIsWalkable(KMPoint(X0, Y0))  );
  -      //fAreas[Y,X] := $FF - cnt * COEF;
  -      fAreas[Y,X] := Max(0, Min(255,cnt) * Byte(  gTerrain.TileIsWalkable(KMPoint(X, Y))  ));
  -      //fAreas[Y,X] := Max(0, Min(255,cnt) * Byte(  gRes.Tileset.TileIsWalkable( gTerrain.Land[Y, X].Terrain )  ));
  -    end;
  -  end;
  -  //procedure InitAreas();
  -  //const
  -  //  RAD = 4;
  -  //  MAX_ELEMENTS = (RAD*2+1) * (RAD*2+1);
  -  //  COEF = Round(255 / MAX_ELEMENTS - 0.5);
  -  //var
  -  //  X,Y, X0,Y0, cnt: Integer;
  -  //begin
  -  //  for Y := 1 to fMapY - 1 do
  -  //  for X := 1 to fMapX - 1 do
  -  //  begin
  -  //    cnt := MAX_ELEMENTS;
  -  //    for Y0 := Max(1, Y - RAD) to Min(Y + RAD, fMapY - 1) do
  -  //    for X0 := Max(1, X - RAD) to Min(X + RAD, fMapX - 1) do
  -  //      cnt := cnt - Byte(  not gRes.Tileset.TileIsWalkable( gTerrain.Land[Y0, X0].Terrain )  );
  -  //    fAreas[Y,X] := Max(0, Min(255,cnt) * Byte(  gRes.Tileset.TileIsWalkable( gTerrain.Land[Y, X].Terrain )  ));
  -  //  end;
  -  //end;
  -  //procedure InitNavMeshAreas();
  -  //var
  -  //  WAD: TKMWalkableAreasDetector;
  -  //begin
  -  //  if AI_GEN_INFLUENCE_MAPS then
  -  //  begin
  -  //    WAD := TKMWalkableAreasDetector.Create(True);
  -  //    try
  -  //      WAD.MarkPolygons();
  -  //      fAreas := WAD.WalkableAreas;
  -  //    finally
  -  //      WAD.Free;
  -  //    end;
  -  //  end;
  -  //end;
  +var
  +  Time: Cardinal;
   begin
     fMapX := gTerrain.MapX;
     fMapY := gTerrain.MapY;
  -  SetLength(fAvoidBuilding, (fMapY+1) * (fMapX+1));
  -  SetLength(fAreas, fMapY, fMapX);
  -  InitAreas();
  +  SetLength(fAvoidBuilding, fMapY * fMapX);
  +
  +  Time := TimeGet();
     InitAvoidBuilding();
     InitArrays();
  -  //InitNavMeshAreas();
  +  Time := TimeGet() - Time;
   end;
   
   
  
positive.code: procedure TKMInfluences.Save(SaveStream: TKMemoryStream);
  var
    PCount: Word;
    Y, Len: Integer;
  begin
    PCount := gHands.Count;
  
  
negative.code:     fUpdateCityIdx, fUpdateArmyIdx: TKMHandIndex; // Update index
      fPresence: TKMWordArray; // Military presence
      fOwnership: TKMByteArray; // City mark the space around itself
  
      fFloodFill: TKMInfluenceFloodFill;
      fInfluenceSearch: TNavMeshInfluenceSearch;
  