anchor.diff:      FCallAddress := ReturnAddress;
     {$endif}
   
  -  Result := 0;
  +  if (Tile > HighTile) then
  +  begin
  +    RaiseInvalidTile(Tile, HighTile, FCallAddress);
  +    Result := 0;
  +  end else
  +  begin
  +    Result := FWeights.Values[Tile];
  +  end;
   end;
   
   procedure TPathMapWeights.SetValue(const Tile: TPathMapTile;
     const Value: Single);
  +var
  +  PValue: PSingle;
   begin
     {$ifNdef CPFLIB}
       FCallAddress := ReturnAddress;
     {$endif}
   
  -
  +  if (Tile > HighTile) then
  +  begin
  +    RaiseInvalidTile(Tile, HighTile, FCallAddress);
  +  end else
  +  begin
  +    PValue := @FWeights.Values[Tile];
  +    if (PValue^ <> Value) then
  +    begin
  +      PValue^ := Value;
  +      Inc(FWeights.UpdateId);
  +    end;
  +  end;
   end;
   
   
  
positive.code:   {$ifNdef CPFLIB}
      FCallAddress := ReturnAddress;
    {$endif}
  
    // internal buffers
    FStartPoints.Buffer.Free;
  
negative.code:     inherited Create;
    {$endif}
  
    if (AHighTile = $FF) then
      CPFException('High tile can''t be equal 255(0xFF), it means a barrier');
  
    FHighTile := AHighTile;
  
    FWeights := PCPFWeights(nil).NewInstance(NativeUInt(FHighTile) + 1, FCallAddress)
  end;
  
  {$ifdef CPFLIB}procedure{$else}destructor{$endif}
  