close Warning: Can't synchronize with repository "(default)" (No changeset 184 in the repository). Look in the Trac log for more information.

source: tags/1.2.0/Forms/UFormUnitMoves.pas

Last change on this file was 150, checked in by chronos, 7 years ago
  • Added: Missing unit moves form files.
File size: 1.5 KB
Line 
1unit UFormUnitMoves;
2
3{$mode delphi}
4
5interface
6
7uses
8 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls;
9
10type
11
12 { TFormUnitMoves }
13
14 TFormUnitMoves = class(TForm)
15 ListView1: TListView;
16 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
17 procedure FormShow(Sender: TObject);
18 procedure ListView1Data(Sender: TObject; Item: TListItem);
19 private
20
21 public
22 procedure ReloadList;
23 end;
24
25var
26 FormUnitMoves: TFormUnitMoves;
27
28implementation
29
30uses
31 UGame, UCore;
32
33{$R *.lfm}
34
35{ TFormUnitMoves }
36
37procedure TFormUnitMoves.ListView1Data(Sender: TObject; Item: TListItem);
38begin
39 if Assigned(Core.Game) and Assigned(Core.Game.CurrentPlayer) then
40 with Core.Game.CurrentPlayer do
41 if (Mode = pmHuman) and (Item.Index < Moves.Count) then
42 with TUnitMove(Moves[Item.Index]) do begin
43 Item.Caption := CellFrom.ToString;
44 Item.SubItems.Add(CellTo.ToString);
45 Item.SubItems.Add(IntToStr(CountOnce));
46 Item.SubItems.Add(IntToStr(CountRepeat));
47 end;
48end;
49
50procedure TFormUnitMoves.FormShow(Sender: TObject);
51begin
52 Core.PersistentForm.Load(Self);
53 ReloadList;
54end;
55
56procedure TFormUnitMoves.FormClose(Sender: TObject;
57 var CloseAction: TCloseAction);
58begin
59 Core.PersistentForm.Save(Self);
60end;
61
62procedure TFormUnitMoves.ReloadList;
63begin
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
67 else ListView1.Items.Count := 0;
68 ListView1.Refresh;
69end;
70
71end.
72
Note: See TracBrowser for help on using the repository browser.