anchor.diff:                              (TX_MAPED_TERRAIN_NO_MASK_HINT, TX_MAPED_TERRAIN_MASK_1_HINT,
                                TX_MAPED_TERRAIN_MASK_2_HINT, TX_MAPED_TERRAIN_MASK_3_HINT,
                                TX_MAPED_TERRAIN_MASK_4_HINT, TX_MAPED_TERRAIN_MASK_5_HINT);
  -
  -  SURFACES_HINTS_TX: array [0..5, 0..SURF_ROW_LEN-1] of Integer = (
  -    (TX_MAPED_TERRAIN_GRASS,          TX_MAPED_TERRAIN_MOSS,          TX_MAPED_TERRAIN_PALE_GRASS,  TX_MAPED_TERRAIN_GRASS_DIRT,    TX_MAPED_TERRAIN_DIRT),
  -    (TX_MAPED_TERRAIN_COAST_SAND,     TX_MAPED_TERRAIN_GRASS_SAND1,   TX_MAPED_TERRAIN_GRASS_SAND2, TX_MAPED_TERRAIN_GRASS_SAND3,   TX_MAPED_TERRAIN_SAND),
  -    (TX_MAPED_TERRAIN_SWAMP,          TX_MAPED_TERRAIN_GRASSY_WATER,  TX_MAPED_TERRAIN_WATER,       TX_MAPED_TERRAIN_FAST_WATER,    TX_MAPED_TERRAIN_CUSTOM),
  -    (TX_MAPED_TERRAIN_SNOW_ON_GRASS,  TX_MAPED_TERRAIN_SNOW_ON_DIRT,  TX_MAPED_TERRAIN_SNOW,        TX_MAPED_TERRAIN_DEEP_SNOW,     TX_MAPED_TERRAIN_GRAVEL),
  -    (TX_MAPED_TERRAIN_STONE,          TX_MAPED_TERRAIN_GOLD_MOUNT,    TX_MAPED_TERRAIN_IRON_MOUNT,  TX_MAPED_TERRAIN_COBBLE_STONE,  TX_MAPED_TERRAIN_GRAVEL),
  -    (TX_MAPED_TERRAIN_COAL,           TX_MAPED_TERRAIN_GOLD,          TX_MAPED_TERRAIN_IRON,        TX_MAPED_TERRAIN_LAVA,          TX_MAPED_TERRAIN_ABYSS));
   
   var
     top: Integer;
  
positive.code: procedure TKMMapEdTerrainBrushes.ResetLastBrushes;
  begin
    fLastShape := hsCircle;
    fLastBrush := Byte(SURFACES[0,0]);
    fLastMagicBrush := False;
  end;
  
  
negative.code:   BTN_TKIND_S_SP_Y = 40;
    SURF_ROW_LEN = 5;
  
    SURFACES: array [0..5, 0..SURF_ROW_LEN-1] of record
      Terrain: TKMTerrainKind;
      Hint: Integer;
    end = (
      ((Terrain: tkGrass;       Hint: TX_MAPED_TERRAIN_GRASS;),
       (Terrain: tkMoss;        Hint: TX_MAPED_TERRAIN_MOSS;),
       (Terrain: tkPaleGrass;   Hint: TX_MAPED_TERRAIN_PALE_GRASS;),
       (Terrain: tkGrassDirt;   Hint: TX_MAPED_TERRAIN_GRASS_DIRT;),
       (Terrain: tkDirt;        Hint: TX_MAPED_TERRAIN_DIRT;)),
      ((Terrain: tkCoastSand;   Hint: TX_MAPED_TERRAIN_COAST_SAND;),
       (Terrain: tkGrassSand1;  Hint: TX_MAPED_TERRAIN_GRASS_SAND1;),
       (Terrain: tkGrassSand2;  Hint: TX_MAPED_TERRAIN_GRASS_SAND2;),
       (Terrain: tkGrassSand3;  Hint: TX_MAPED_TERRAIN_GRASS_SAND3;),
       (Terrain: tkSand;        Hint: TX_MAPED_TERRAIN_SAND;)),
      ((Terrain: tkSwamp;       Hint: TX_MAPED_TERRAIN_SWAMP;),
       (Terrain: tkGrassyWater; Hint: TX_MAPED_TERRAIN_GRASSY_WATER;),
       (Terrain: tkWater;       Hint: TX_MAPED_TERRAIN_WATER;),
       (Terrain: tkFastWater;   Hint: TX_MAPED_TERRAIN_FAST_WATER;),
       (Terrain: tkCustom;      Hint: TX_MAPED_TERRAIN_CUSTOM;)),
      ((Terrain: tkSnowOnGrass; Hint: TX_MAPED_TERRAIN_SNOW_ON_GRASS;),
       (Terrain: tkSnowOnDirt;  Hint: TX_MAPED_TERRAIN_SNOW_ON_DIRT;),
       (Terrain: tkSnow;        Hint: TX_MAPED_TERRAIN_SNOW;),
       (Terrain: tkDeepSnow;    Hint: TX_MAPED_TERRAIN_DEEP_SNOW;),
       (Terrain: tkIce;         Hint: TX_MAPED_TERRAIN_ICE;)),
      ((Terrain: tkStone;       Hint: TX_MAPED_TERRAIN_STONE;),
       (Terrain: tkGoldMount;   Hint: TX_MAPED_TERRAIN_GOLD_MOUNT;),
       (Terrain: tkIronMount;   Hint: TX_MAPED_TERRAIN_IRON_MOUNT;),
       (Terrain: tkCobbleStone; Hint: TX_MAPED_TERRAIN_COBBLE_STONE;),
       (Terrain: tkGravel;      Hint: TX_MAPED_TERRAIN_GRAVEL;)),
      ((Terrain: tkCoal;        Hint: TX_MAPED_TERRAIN_COAL;),
       (Terrain: tkGold;        Hint: TX_MAPED_TERRAIN_GOLD;),
       (Terrain: tkIron;        Hint: TX_MAPED_TERRAIN_IRON;),
       (Terrain: tkLava;        Hint: TX_MAPED_TERRAIN_LAVA;),
       (Terrain: tkAbyss;       Hint: TX_MAPED_TERRAIN_ABYSS;))
    );
  
  type
    TMBrushButtonType = (bbtBrush = -1, bbtMask = -2);
  