Changeset 273 for trunk/UClientGUI.pas


Ignore:
Timestamp:
Jan 30, 2019, 8:08:44 AM (6 years ago)
Author:
chronos
Message:
  • Added: Show units shape to see in which cell units are placed.
  • Fixed: Do not place units with zero power in zero power cells.
  • Fixed: Better checks of cell power if cell is without unit.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UClientGUI.pas

    r270 r273  
    4949  public
    5050    View: TView;
    51     ShowCellGrid: Boolean;
     51    CellGridVisible: Boolean;
     52    UnitShapeVisible: Boolean;
    5253    procedure DrawArrow(Canvas: TCanvas; Pos: TPoint; Angle: Double;
    5354      Text: string; View: TView);
     
    110111  Points: array of Classes.TPoint;
    111112  TextSize: TSize;
     113  R: Integer;
    112114begin
    113115  if Cell.MapCell.Extra = etObjectiveTarget then begin
     
    118120    //Pen.Style := psClear;
    119121    Pen.Style := psSolid;
    120     if ShowCellGrid then begin
     122    if CellGridVisible then begin
    121123      Pen.Color := clBlack;
    122124      Pen.Width := Round(2 * View.Zoom);
     
    144146        Round(TextPos.Y) - TextSize.cy div 2, Text, False);
    145147    end;
     148    if UnitShapeVisible and Assigned(Cell.MapCell.OneUnit) then begin
     149      TextPos := View.CellToCanvasPos(Pos);
     150      R := Trunc(70 * View.Zoom);
     151      Pen.Color := clWhite;
     152      Pen.Style := psSolid;
     153      Pen.Width := Round(10 * View.Zoom);
     154      Brush.Style := bsClear;
     155      TCanvasEx.Ellipse(Canvas, TRect.Create(
     156        TPoint.Create(TextPos.X - R, TextPos.Y - R),
     157        TPoint.Create(TextPos.X + R, TextPos.Y + R)
     158      ));
     159    end;
    146160  end;
    147161end;
     
    154168  Points: array of Classes.TPoint;
    155169  TextSize: TSize;
     170  R: Integer;
    156171begin
    157172  if Cell.Extra = etObjectiveTarget then begin
     
    188203
    189204    // Show cell text
    190     if (Cell.OneUnit.Power <> 0) or (Cell.Extra = etObjectiveTarget) then begin
     205    if Assigned(Cell.OneUnit) and (Cell.OneUnit.Power <> 0) or
     206      (Cell.Extra = etObjectiveTarget) then begin
    191207      Pen.Style := psSolid;
    192208      Font.Color := clWhite;
     
    197213      TCanvasEx.TextOutEx(Canvas, Round(TextPos.X) - TextSize.cx div 2,
    198214        Round(TextPos.Y) - TextSize.cy div 2, Text, False);
     215    end;
     216    if UnitShapeVisible and Assigned(Cell.OneUnit) then begin
     217      TextPos := View.CellToCanvasPos(Pos);
     218      R := Trunc(70 * View.Zoom);
     219      Pen.Color := clWhite;
     220      Pen.Style := psSolid;
     221      Pen.Width := Round(10 * View.Zoom);
     222      Brush.Style := bsClear;
     223      TCanvasEx.Ellipse(Canvas, TRect.Create(
     224        TPoint.Create(TextPos.X - R, TextPos.Y - R),
     225        TPoint.Create(TextPos.X + R, TextPos.Y + R)
     226      ));
    199227    end;
    200228  end;
Note: See TracChangeset for help on using the changeset viewer.