Ignore:
Timestamp:
Sep 28, 2011, 8:34:06 PM (13 years ago)
Author:
george
Message:
  • Added: Introduced player pool for selection of players for new game.
  • Fixed: Deadlock on program exit during threads termination.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UNewGameForm.pas

    r22 r23  
    1919    ListView1: TListView;
    2020    procedure ButtonStartClick(Sender: TObject);
    21     procedure FormCreate(Sender: TObject);
     21    procedure FormShow(Sender: TObject);
    2222    procedure ListView1Change(Sender: TObject; Item: TListItem;
    2323      Change: TItemChange);
     
    4040{ TNewGameForm }
    4141
    42 procedure TNewGameForm.FormCreate(Sender: TObject);
    43 var
    44   NewItem: TListItem;
    45   I: Integer;
    46 begin
    47   with ListView1 do try
    48     BeginUpdate;
    49     Clear;
    50     for I := 0 to Engine.Players.Count - 1 do
    51     with TPlayer(Engine.Players[I]) do begin
    52       NewItem := Items.Add;
    53       NewItem.Caption := Name;
    54       NewItem.SubItems.Add(IntToStr(Color));
    55       NewItem.SubItems.Add('');
    56       NewItem.Checked := Enabled;
    57       NewItem.Data := Pointer(Engine.Players[I]);
    58     end;
    59   finally
    60     EndUpdate;
    61   end;
    62 end;
    63 
    6442procedure TNewGameForm.ListView1Change(Sender: TObject; Item: TListItem;
    6543  Change: TItemChange);
     
    7452end;
    7553
     54procedure TNewGameForm.FormShow(Sender: TObject);
     55var
     56  NewItem: TListItem;
     57  I: Integer;
     58begin
     59  with ListView1 do try
     60    BeginUpdate;
     61    Clear;
     62    for I := 0 to Engine.PlayerPool.Count - 1 do
     63    with TPlayer(Engine.PlayerPool[I]) do begin
     64      NewItem := Items.Add;
     65      NewItem.Caption := Name;
     66      NewItem.SubItems.Add(IntToStr(Color));
     67      NewItem.SubItems.Add('');
     68      NewItem.Checked := Enabled;
     69      NewItem.Data := Pointer(Engine.PlayerPool[I]);
     70    end;
     71  finally
     72    EndUpdate;
     73  end;
     74end;
     75
    7676end.
    7777
Note: See TracChangeset for help on using the changeset viewer.