Ignore:
Timestamp:
Sep 19, 2018, 2:05:52 PM (6 years ago)
Author:
chronos
Message:
  • Modified: UGame unit was split to UPlayer, UMap and UClientGUI units to have better logical separation of game classes.
  • Modified: Drawing methods moved from TMap and TPlayerMap to TClientGUI. Generic TClient class and TComputer classes don't need have any drawing support.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormClient.pas

    r227 r231  
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
    99  UGame, LCLType, Menus, ActnList, ComCtrls, dateutils, XMLConf, DOM,
    10   UGeometry, UGameClient, UGameProtocol, UThreading;
     10  UGeometry, UGameClient, UGameProtocol, UThreading, UPlayer, UClientGUI;
    1111
    1212const
     
    6969    procedure Timer1Timer(Sender: TObject);
    7070  private
    71     FClient: TClient;
     71    FClient: TClientGUI;
    7272    TempBitmap: TBitmap;
    7373    StartMousePoint: TPoint;
     
    8080    TimerPeriod: TDateTime;
    8181    TurnActive: Boolean;
    82     procedure SetClient(AValue: TClient);
     82    procedure SetClient(AValue: TClientGUI);
    8383    procedure DoClientChange(Sender: TObject);
    8484    procedure DoGameEnd(Sender: TObject);
     
    9494    procedure UpdateInterface;
    9595    procedure Redraw;
    96     property Client: TClient read FClient write SetClient;
     96    property Client: TClientGUI read FClient write SetClient;
    9797  end;
    9898
     
    178178      TempBitmap.Canvas.Brush.Color := BackGroundColor; //clBackground; //PaintBox1.GetColorResolvingParent;
    179179      TempBitmap.Canvas.FillRect(0, 0, PaintBox1.Width, PaintBox1.Height);
    180       if Assigned(ControlPlayer) then ControlPlayer.Paint(TempBitmap.Canvas, View)
    181         else Core.Game.Map.Paint(TempBitmap.Canvas, View);
     180      Client.Paint(TempBitmap.Canvas, View);
    182181      PaintBox1.Canvas.Draw(0, 0, TempBitmap);
    183182    end else begin
     
    186185      PaintBox1.Canvas.FillRect(0, 0, PaintBox1.Width, PaintBox1.Height);
    187186      {$endif}
    188       if Assigned(ControlPlayer) then ControlPlayer.Paint(PaintBox1.Canvas, View)
    189         else Core.Game.Map.Paint(PaintBox1.Canvas, View);
     187      Client.Paint(PaintBox1.Canvas, View)
    190188    end;
    191189  end;
     
    227225end;
    228226
    229 procedure TFormClient.SetClient(AValue: TClient);
     227procedure TFormClient.SetClient(AValue: TClientGUI);
    230228begin
    231229  if FClient = AValue then Exit;
     
    474472    with Core.Game do
    475473      if Assigned(Client.ControlPlayer) then
    476         Cell := Client.ControlPlayer.PlayerMap.PosToCell(Client.View.CanvasToCellPos(TPoint.Create(X, Y)), Client.View);
     474        Cell := Client.ControlPlayer.PlayerMap.PosToCell(Client.View.CanvasToCellPos(TPoint.Create(X, Y)));
    477475        //else Cell := Client.Game.Map.PosToCell(Client.View.CanvasToCellPos(TPoint.Create(X, Y)), Client.View);
    478476    if Assigned(Cell) then begin
Note: See TracChangeset for help on using the changeset viewer.