Changeset 357


Ignore:
Timestamp:
Apr 8, 2021, 10:07:02 PM (7 months ago)
Author:
chronos
Message:
  • Fixed: Bad city form drawing after clicking on small map mode change icon to show supported units.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/CityScreen.pas

    r356 r357  
    7474    CityAreaInfo: TCityAreaInfo;
    7575    AreaMap: TIsoMap;
     76    NoMap: TIsoMap;
    7677    CityMapTemplate: TBitmap;
    7778    SmallCityMapTemplate: TBitmap;
     
    198199  RedTex := TTexture.Create;
    199200  BarTex := TTexture.Create;
     201  NoMap := TIsoMap.Create;
    200202  AreaMap := TIsoMap.Create;
    201203  AreaMap.SetOutput(offscreen);
     
    253255procedure TCityDlg.FormDestroy(Sender: TObject);
    254256begin
     257  FreeAndNil(NoMap);
    255258  FreeAndNil(AreaMap);
    256259  FreeAndNil(SmallCityMap);
     
    594597
    595598  with AreaMap do begin
    596   rx := (192 + xxt * 2 - 1) div (xxt * 2);
    597   ry := (96 + yyt * 2 - 1) div (yyt * 2);
    598   AreaMap.Paint(xmArea - xxt * 2 * rx, ymArea - yyt * 2 * ry - 3 * yyt,
    599     dLoc(cLoc, -2 * rx + 1, -2 * ry - 1), 4 * rx - 1, 4 * ry + 1, cLoc, cOwner,
    600     false, AllowChange and IsCityAlive and
    601     (c.Status and csResourceWeightsMask = 0));
    602   BitBltCanvas(offscreen.Canvas, xmArea + 102, 42, 90, 33, Back.Canvas,
    603     xmArea + 102, 42);
    604 
    605   if IsCityAlive then
    606     for dy := -3 to 3 do
    607       for dx := -3 to 3 do
    608         if ((dx + dy) and 1 = 0) and (dx * dx * dy * dy < 81) then
    609         begin
    610           Loc1 := dLoc(cLoc, dx, dy);
    611           av := CityAreaInfo.Available[(dy + 3) shl 2 + (dx + 3) shr 1];
    612           if ((av = faNotAvailable) or (av = faTreaty) or (av = faInvalid)) and
    613             ((Loc1 < 0) or (Loc1 >= G.lx * G.ly) or (MyMap[Loc1] and fCity = 0))
    614           then
    615             Sprite(offscreen, HGrTerrain, xmArea - xxt + xxt * dx,
    616               ymArea - yyt + yyt * dy, xxt * 2, yyt * 2, 1 + 5 * (xxt * 2 + 1),
    617               1 + yyt + 15 * (yyt * 3 + 1));
    618           if (1 shl ((dy + 3) shl 2 + (dx + 3) shr 1) and c.Tiles <> 0) then
    619             PaintResources(xmArea - xxt + xxt * dx, ymArea - yyt + yyt * dy,
    620               Loc1, (dx = 0) and (dy = 0));
    621         end;
     599    rx := (192 + xxt * 2 - 1) div (xxt * 2);
     600    ry := (96 + yyt * 2 - 1) div (yyt * 2);
     601    AreaMap.Paint(xmArea - xxt * 2 * rx, ymArea - yyt * 2 * ry - 3 * yyt,
     602      dLoc(cLoc, -2 * rx + 1, -2 * ry - 1), 4 * rx - 1, 4 * ry + 1, cLoc, cOwner,
     603      false, AllowChange and IsCityAlive and
     604      (c.Status and csResourceWeightsMask = 0));
     605    BitBltCanvas(offscreen.Canvas, xmArea + 102, 42, 90, 33, Back.Canvas,
     606      xmArea + 102, 42);
     607
     608    if IsCityAlive then
     609      for dy := -3 to 3 do
     610        for dx := -3 to 3 do
     611          if ((dx + dy) and 1 = 0) and (dx * dx * dy * dy < 81) then begin
     612            Loc1 := dLoc(cLoc, dx, dy);
     613            av := CityAreaInfo.Available[(dy + 3) shl 2 + (dx + 3) shr 1];
     614            if ((av = faNotAvailable) or (av = faTreaty) or (av = faInvalid)) and
     615              ((Loc1 < 0) or (Loc1 >= G.lx * G.ly) or (MyMap[Loc1] and fCity = 0))
     616            then
     617              Sprite(offscreen, HGrTerrain, xmArea - xxt + xxt * dx,
     618                ymArea - yyt + yyt * dy, xxt * 2, yyt * 2, 1 + 5 * (xxt * 2 + 1),
     619                1 + yyt + 15 * (yyt * 3 + 1));
     620            if (1 shl ((dy + 3) shl 2 + (dx + 3) shr 1) and c.Tiles <> 0) then
     621              PaintResources(xmArea - xxt + xxt * dx, ymArea - yyt + yyt * dy,
     622                Loc1, (dx = 0) and (dy = 0));
     623          end;
    622624  end;
    623625
     
    915917      Imp5Area.Hint := '';
    916918  end
    917   else { if SmallMapMode=smSupportedUnits then }
     919  else { if SmallMapMode = smSupportedUnits then }
    918920  begin
    919921    LoweredTextout(offscreen.Canvas, -1, MainTexture, xZoomMap + 6,
     
    932934            y := ((Cnt - 6 * Page) div 3) * 52 + yZoomMap + 20;
    933935            MakeUnitInfo(me, MyUn[i], UnitInfo);
    934             AreaMap.SetOutput(offscreen);
    935             AreaMap.PaintUnit(x, y, UnitInfo, MyUn[i].Status);
     936            NoMap.SetOutput(offscreen);
     937            NoMap.PaintUnit(x, y, UnitInfo, MyUn[i].Status);
    936938
    937939            for j := 0 to UnitReport.FoodSupport - 1 do
     
    13191321    else if (x >= xmArea - 192) and (x < xmArea + 192) and (y >= ymArea - 96)
    13201322      and (y < ymArea + 96) then
    1321     with AreaMap do
    1322     begin
     1323    with AreaMap do begin
    13231324      qx := ((4000 * xxt * yyt) + (x - xmArea) * (yyt * 2) + (y - ymArea + yyt)
    13241325        * (xxt * 2)) div (xxt * yyt * 4) - 1000;
Note: See TracChangeset for help on using the changeset viewer.