Changeset 28 for trunk/UGame.pas


Ignore:
Timestamp:
Mar 3, 2014, 8:53:04 PM (10 years ago)
Author:
chronos
Message:
  • Fixed: Use modified player list from New game. Allow more players then two with different colors.
  • Added: Toolbar for quick access to common actions.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UGame.pas

    r27 r28  
    1212  CellMulX = 1.12;
    1313  CellMulY = 1.292;
     14  MaxPlayerCount = 8;
    1415
    1516type
     
    6465    function CanvasToCellRect(Pos: TRect): TRect;
    6566    function CellToCanvasRect(Pos: TRect): TRect;
     67    procedure Assign(Source: TView);
    6668    property DestRect: TRect read FDestRect write SetDestRect;
    6769    property Zoom: Double read FZoom write SetZoom;
     
    164166const
    165167  PlayerModeText: array[TPlayerMode] of string = ('Human', 'Computer');
     168  clOrange = $009Aff;
     169  PlayerColors: array[0..7] of TColor = (clBlue, clRed, clGreen, clOrange, clPurple, clMaroon, clAqua, clFuchsia);
    166170
    167171
     
    310314  Result.TopLeft := CellToCanvasPos(Pos.TopLeft);
    311315  Result.BottomRight := CellToCanvasPos(Pos.BottomRight);
     316end;
     317
     318procedure TView.Assign(Source: TView);
     319begin
     320  SourceRect := Source.SourceRect;
     321  DestRect := Source.DestRect;
     322  Zoom := Source.Zoom;
    312323end;
    313324
     
    398409  StartUnits := Source.StartUnits;
    399410  SelectedCell := Source.SelectedCell;
    400   View.Zoom := Source.View.Zoom;
     411  FocusedCell := Source.FocusedCell;
     412  View.Assign(Source.View);
    401413end;
    402414
     
    481493
    482494procedure TGame.SetRunning(AValue: Boolean);
     495var
     496  I: Integer;
    483497begin
    484498  if FRunning = AValue then Exit;
     
    486500    if Players.Count < 2 then raise Exception.Create(SMinimumPlayers);
    487501    FRunning := AValue;
    488   end else FRunning := AValue;
     502  end else begin
     503    FRunning := AValue;
     504    for I := 0 to Players.Count - 1 do
     505    with TPlayer(Players[I]) do begin
     506      SelectedCell := nil;
     507      FocusedCell := nil;
     508    end;
     509  end;
    489510end;
    490511
     
    739760    end else begin
    740761      Pen.Color := clBlack;
    741       Pen.Style := psClear;
     762      // Cannot set clear border as it will display shifted on gtk2
     763      //Pen.Style := psClear;
     764      Pen.Color := Brush.Color;
     765      Pen.Style := psSolid;
    742766    end;
    743767    Points := GetHexagonPolygon(Point(Trunc(Pos.X), Trunc(Pos.Y)), Point(Trunc(HexSize.X), Trunc(HexSize.Y)));
    744     Polygon(Points);
     768    Polygon(Points, False, 0, Length(Points));
     769    //Rectangle(Trunc(Pos.X), Trunc(Pos.Y), Trunc(Pos.X + HexSize.X), Trunc(Pos.Y + HexSize.Y));
    745770    Pen.Style := psSolid;
    746771    Font.Color := clWhite;
Note: See TracChangeset for help on using the changeset viewer.