Ignore:
Timestamp:
Jun 21, 2024, 12:44:53 PM (5 months ago)
Author:
chronos
Message:
  • Modified: Remove U prefix from unit names.
  • Modified: Use TFormEx for all forms for code simplification.
File:
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/Forms/FormUnitMoves.pas

    r316 r317  
    1 unit UFormUnitMoves;
     1unit FormUnitMoves;
    22
    33interface
    44
    55uses
    6   Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls;
     6  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls,
     7  FormEx;
    78
    89type
     
    1011  { TFormUnitMoves }
    1112
    12   TFormUnitMoves = class(TForm)
     13  TFormUnitMoves = class(TFormEx)
    1314    ListView1: TListView;
    14     procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
    1515    procedure FormShow(Sender: TObject);
    1616    procedure ListView1Data(Sender: TObject; Item: TListItem);
    17   private
    18 
    1917  public
    2018    procedure ReloadList;
    2119  end;
    2220
    23 var
    24   FormUnitMoves: TFormUnitMoves;
    2521
    2622implementation
    2723
    2824uses
    29   UGame, UCore, UPlayer;
     25  Game, Core, Player;
    3026
    3127{$R *.lfm}
     
    3531procedure TFormUnitMoves.ListView1Data(Sender: TObject; Item: TListItem);
    3632begin
    37   if Assigned(Core.Game) and Assigned(Core.Game.CurrentPlayer) then
    38   with Core.Game.CurrentPlayer do
     33  if Assigned(Core.Core.Game) and Assigned(Core.Core.Game.CurrentPlayer) then
     34  with Core.Core.Game.CurrentPlayer do
    3935  if (Mode = pmHuman) and (Item.Index < Moves.Count) then
    4036  with TUnitMove(Moves[Item.Index]) do begin
     
    4844procedure TFormUnitMoves.FormShow(Sender: TObject);
    4945begin
    50   Core.PersistentForm.Load(Self);
    51   Core.ThemeManager1.UseTheme(Self);
    52   Core.CoolTranslator1.TranslateComponentRecursive(Self);
    5346  ReloadList;
    54 end;
    55 
    56 procedure TFormUnitMoves.FormClose(Sender: TObject;
    57   var CloseAction: TCloseAction);
    58 begin
    59   Core.PersistentForm.Save(Self);
    6047end;
    6148
    6249procedure TFormUnitMoves.ReloadList;
    6350begin
    64   if Assigned(Core.Game) and Assigned(Core.Game.CurrentPlayer) and
    65   (Core.Game.CurrentPlayer.Mode = pmHuman) then
    66     ListView1.Items.Count := Core.Game.CurrentPlayer.Moves.Count
     51  if Assigned(Core.Core.Game) and Assigned(Core.Core.Game.CurrentPlayer) and
     52  (Core.Core.Game.CurrentPlayer.Mode = pmHuman) then
     53    ListView1.Items.Count := Core.Core.Game.CurrentPlayer.Moves.Count
    6754  else ListView1.Items.Count := 0;
    6855  ListView1.Refresh;
Note: See TracChangeset for help on using the changeset viewer.