Changeset 282 for trunk/Forms/UFormPlayer.pas
- Timestamp:
- Mar 10, 2019, 4:48:41 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormPlayer.pas
r279 r282 20 20 ComboBoxMode: TComboBox; 21 21 ComboBoxAgressivity: TComboBox; 22 ComboBoxNation: TComboBox; 22 23 EditName: TEdit; 23 24 Label1: TLabel; … … 26 27 Label4: TLabel; 27 28 Label5: TLabel; 29 Label6: TLabel; 28 30 SpinEditStartUnits: TSpinEdit; 29 31 procedure ComboBoxModeChange(Sender: TObject); … … 48 50 49 51 uses 50 UCore ;52 UCore, UNation; 51 53 52 54 resourcestring … … 111 113 112 114 procedure TFormPlayer.LoadData(Player: TPlayer); 115 var 116 I: Integer; 113 117 begin 118 while ComboBoxNation.Items.Count > TGame(Player.Game).GameSystem.Nations.Count do 119 ComboBoxNation.Items.Delete(ComboBoxNation.Items.Count - 1); 120 while ComboBoxNation.Items.Count < TGame(Player.Game).GameSystem.Nations.Count do 121 ComboBoxNation.Items.Add(''); 122 for I := 0 to TGame(Player.Game).GameSystem.Nations.Count - 1 do begin 123 ComboBoxNation.Items[I] := TGame(Player.Game).GameSystem.Nations[I].Name; 124 ComboBoxNation.Items.Objects[I] := TGame(Player.Game).GameSystem.Nations[I]; 125 end; 126 127 ComboBoxNation.ItemIndex := ComboBoxNation.Items.IndexOfObject(Player.Nation); 128 if (ComboBoxNation.ItemIndex = -1) and (ComboBoxNation.Items.Count > 0) then 129 ComboBoxNation.ItemIndex := 0; 130 114 131 EditName.Text := Player.Name; 115 132 ComboBoxMode.ItemIndex := Integer(Player.Mode); … … 123 140 procedure TFormPlayer.SaveData(Player: TPlayer); 124 141 begin 142 Player.Nation := TNation(ComboBoxNation.Items.Objects[ComboBoxNation.ItemIndex]); 125 143 Player.Name := EditName.Text; 126 144 Player.Mode := TPlayerMode(ComboBoxMode.ItemIndex);
Note:
See TracChangeset
for help on using the changeset viewer.