source: trunk/Forms/FormUnitMoves.pas

Last change on this file was 318, checked in by chronos, 6 months ago
  • Modified: Code cleanup.
File size: 1.2 KB
Line 
1unit FormUnitMoves;
2
3interface
4
5uses
6 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls,
7 FormEx, Game;
8
9type
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
23implementation
24
25uses
26 Player;
27
28{$R *.lfm}
29
30{ TFormUnitMoves }
31
32procedure TFormUnitMoves.ListView1Data(Sender: TObject; Item: TListItem);
33begin
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;
43end;
44
45procedure TFormUnitMoves.FormShow(Sender: TObject);
46begin
47 ReloadList;
48end;
49
50procedure TFormUnitMoves.ReloadList;
51begin
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;
57end;
58
59end.
60
Note: See TracBrowser for help on using the repository browser.