Changeset 594 for trunk


Ignore:
Timestamp:
Aug 11, 2024, 9:03:53 PM (3 months ago)
Author:
chronos
Message:
  • Fixed: Do not show units and cities in maps mini map preview.
  • Fixed: Editor maps access violation on Windows.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/MiniMap.pas

    r591 r594  
    184184          MiniPixel.SetX(xm);
    185185          Tile := Map.Tiles[ScaleFromNative(x) + Size.X * ScaleFromNative(y)];
    186           if Tile and fTerrain = fUNKNOWN then
    187             cm := $000000
    188           else if Tile and smCity <> 0 then begin
    189             if Tile and smOwned <> 0 then cm := OwnColor
    190               else cm := EnemyColor;
    191             if y > 0 then begin
    192               // 2x2 city dot covers two lines
    193               PrevMiniPixel.SetX(xm);
    194               if (PByte(PrevMiniPixel.Pixel) >= Bitmap.RawImage.Data) and
    195               (PByte(PrevMiniPixel.Pixel) < (Bitmap.RawImage.Data + yy * PrevMiniPixel.BytesPerLine)) then begin
    196                 PrevMiniPixel.PixelB := cm shr 16;
    197                 PrevMiniPixel.PixelG:= cm shr 8 and $FF;
    198                 PrevMiniPixel.PixelR := cm and $FF;
    199               end;
    200             end;
    201           end
    202           else if (i = 0) and (Tile and smUnit <> 0) then begin
    203             if Tile and smOwned <> 0 then cm := OwnColor
    204               else cm := EnemyColor;
    205           end else
    206             cm := Colors[Tile and fTerrain, i];
     186          if Tile and fTerrain = fUNKNOWN then cm := $000000
     187            else cm := Colors[Tile and fTerrain, i];
     188          // TODO: Needs to use (yy - 1) to avoid access violation for unknown reason
    207189          if (PByte(MiniPixel.Pixel) >= Bitmap.RawImage.Data) and
    208           (PByte(MiniPixel.Pixel) < (Bitmap.RawImage.Data + yy * MiniPixel.BytesPerLine)) then begin
     190          (PByte(MiniPixel.Pixel) < (Bitmap.RawImage.Data + (yy - 1) * MiniPixel.BytesPerLine)) then begin
    209191            MiniPixel.PixelB := (cm shr 16) and $ff;
    210192            MiniPixel.PixelG := (cm shr 8) and $ff;
Note: See TracChangeset for help on using the changeset viewer.