Line | |
---|
1 | unit FormUnitMoves;
|
---|
2 |
|
---|
3 | interface
|
---|
4 |
|
---|
5 | uses
|
---|
6 | Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls,
|
---|
7 | FormEx, Game;
|
---|
8 |
|
---|
9 | type
|
---|
10 |
|
---|
11 | { TFormUnitMoves }
|
---|
12 |
|
---|
13 | TFormUnitMoves = class(TFormEx)
|
---|
14 | ListView1: TListView;
|
---|
15 | procedure FormShow(Sender: TObject);
|
---|
16 | procedure ListView1Data(Sender: TObject; Item: TListItem);
|
---|
17 | public
|
---|
18 | Game: TGame;
|
---|
19 | procedure ReloadList;
|
---|
20 | end;
|
---|
21 |
|
---|
22 |
|
---|
23 | implementation
|
---|
24 |
|
---|
25 | uses
|
---|
26 | Player;
|
---|
27 |
|
---|
28 | {$R *.lfm}
|
---|
29 |
|
---|
30 | { TFormUnitMoves }
|
---|
31 |
|
---|
32 | procedure TFormUnitMoves.ListView1Data(Sender: TObject; Item: TListItem);
|
---|
33 | begin
|
---|
34 | if Assigned(Game) and Assigned(Game.CurrentPlayer) then
|
---|
35 | with Game.CurrentPlayer do
|
---|
36 | if (Mode = pmHuman) and (Item.Index < Moves.Count) then
|
---|
37 | with TUnitMove(Moves[Item.Index]) do begin
|
---|
38 | Item.Caption := IntToStr(CellFrom.MapCell.Id);
|
---|
39 | Item.SubItems.Add(IntToStr(CellTo.Mapcell.Id));
|
---|
40 | Item.SubItems.Add(IntToStr(CountOnce));
|
---|
41 | Item.SubItems.Add(IntToStr(CountRepeat));
|
---|
42 | end;
|
---|
43 | end;
|
---|
44 |
|
---|
45 | procedure TFormUnitMoves.FormShow(Sender: TObject);
|
---|
46 | begin
|
---|
47 | ReloadList;
|
---|
48 | end;
|
---|
49 |
|
---|
50 | procedure TFormUnitMoves.ReloadList;
|
---|
51 | begin
|
---|
52 | if Assigned(Game) and Assigned(Game.CurrentPlayer) and
|
---|
53 | (Game.CurrentPlayer.Mode = pmHuman) then
|
---|
54 | ListView1.Items.Count := Game.CurrentPlayer.Moves.Count
|
---|
55 | else ListView1.Items.Count := 0;
|
---|
56 | ListView1.Refresh;
|
---|
57 | end;
|
---|
58 |
|
---|
59 | end.
|
---|
60 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.