Changeset 282 for trunk/Forms


Ignore:
Timestamp:
Mar 10, 2019, 4:48:41 PM (6 years ago)
Author:
chronos
Message:
  • Modified: Allow to set nation in player settings.
Location:
trunk/Forms
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormNew.lfm

    r281 r282  
    258258        object ComboBoxGridType: TComboBox
    259259          Left = 146
    260           Height = 38
     260          Height = 42
    261261          Top = 104
    262262          Width = 304
     
    275275        object ComboBoxMapShape: TComboBox
    276276          Left = 146
    277           Height = 38
     277          Height = 42
    278278          Top = 144
    279279          Width = 304
  • trunk/Forms/UFormNew.pas

    r281 r282  
    514514  FormChat.Show;
    515515  Players := TPlayers.Create;
     516  Players.Game := GamePreview;
    516517  FormPlayers := TFormPlayers.Create(nil);
    517518  FormPlayers.MinItemCount := MinPlayerCount;
  • trunk/Forms/UFormPlayer.lfm

    r279 r282  
    11object FormPlayer: TFormPlayer
    22  Left = 470
    3   Height = 344
    4   Top = 219
    5   Width = 522
     3  Height = 406
     4  Top = 157
     5  Width = 652
    66  Caption = 'Player'
    7   ClientHeight = 344
    8   ClientWidth = 522
     7  ClientHeight = 406
     8  ClientWidth = 652
    99  Constraints.MinHeight = 344
    1010  Constraints.MinWidth = 522
     
    2727    Height = 43
    2828    Top = 27
    29     Width = 339
     29    Width = 469
    3030    Anchors = [akTop, akLeft, akRight]
    3131    TabOrder = 0
    3232  end
    3333  object ButtonCancel: TButton
    34     Left = 278
     34    Left = 274
    3535    Height = 25
    36     Top = 307
     36    Top = 366
    3737    Width = 75
    3838    Anchors = [akRight, akBottom]
     
    4242  end
    4343  object ButtonOk: TButton
    44     Left = 403
     44    Left = 394
    4545    Height = 25
    46     Top = 307
     46    Top = 369
    4747    Width = 75
    4848    Anchors = [akRight, akBottom]
     
    5555    Left = 168
    5656    Height = 38
    57     Top = 72
    58     Width = 339
     57    Top = 124
     58    Width = 469
    5959    Anchors = [akTop, akLeft, akRight]
    6060    ItemHeight = 0
     
    7272    Left = 24
    7373    Height = 26
    74     Top = 72
     74    Top = 128
    7575    Width = 53
    7676    Caption = 'Mode:'
     
    8080    Left = 24
    8181    Height = 26
    82     Top = 128
     82    Top = 176
    8383    Width = 50
    8484    Caption = 'Color:'
     
    8888    Left = 168
    8989    Height = 42
    90     Top = 120
    91     Width = 339
     90    Top = 168
     91    Width = 469
    9292    Style = [cbStandardColors, cbExtendedColors, cbCustomColor, cbPrettyNames]
    9393    Anchors = [akTop, akLeft, akRight]
     
    9898    Left = 24
    9999    Height = 26
    100     Top = 168
     100    Top = 216
    101101    Width = 98
    102102    Caption = 'Agressivity:'
     
    105105  object ComboBoxAgressivity: TComboBox
    106106    Left = 168
    107     Height = 42
    108     Top = 168
    109     Width = 339
     107    Height = 38
     108    Top = 216
     109    Width = 469
    110110    Anchors = [akTop, akLeft, akRight]
    111111    ItemHeight = 0
     
    122122    Left = 24
    123123    Height = 30
    124     Top = 208
     124    Top = 256
    125125    Width = 109
    126126    Caption = 'Defensive'
     
    130130    Left = 24
    131131    Height = 26
    132     Top = 248
     132    Top = 296
    133133    Width = 94
    134134    Caption = 'Start units:'
     
    138138    Left = 224
    139139    Height = 43
    140     Top = 240
     140    Top = 288
    141141    Width = 112
    142142    MaxValue = 99
    143143    TabOrder = 7
    144144  end
     145  object ComboBoxNation: TComboBox
     146    Left = 168
     147    Height = 42
     148    Top = 76
     149    Width = 469
     150    Anchors = [akTop, akLeft, akRight]
     151    ItemHeight = 0
     152    OnChange = ComboBoxModeChange
     153    Style = csDropDownList
     154    TabOrder = 8
     155  end
     156  object Label6: TLabel
     157    Left = 24
     158    Height = 26
     159    Top = 80
     160    Width = 63
     161    Caption = 'Nation:'
     162    ParentColor = False
     163  end
    145164end
  • trunk/Forms/UFormPlayer.pas

    r279 r282  
    2020    ComboBoxMode: TComboBox;
    2121    ComboBoxAgressivity: TComboBox;
     22    ComboBoxNation: TComboBox;
    2223    EditName: TEdit;
    2324    Label1: TLabel;
     
    2627    Label4: TLabel;
    2728    Label5: TLabel;
     29    Label6: TLabel;
    2830    SpinEditStartUnits: TSpinEdit;
    2931    procedure ComboBoxModeChange(Sender: TObject);
     
    4850
    4951uses
    50   UCore;
     52  UCore, UNation;
    5153
    5254resourcestring
     
    111113
    112114procedure TFormPlayer.LoadData(Player: TPlayer);
     115var
     116  I: Integer;
    113117begin
     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
    114131  EditName.Text := Player.Name;
    115132  ComboBoxMode.ItemIndex := Integer(Player.Mode);
     
    123140procedure TFormPlayer.SaveData(Player: TPlayer);
    124141begin
     142  Player.Nation := TNation(ComboBoxNation.Items.Objects[ComboBoxNation.ItemIndex]);
    125143  Player.Name := EditName.Text;
    126144  Player.Mode := TPlayerMode(ComboBoxMode.ItemIndex);
  • trunk/Forms/UFormPlayers.lfm

    r279 r282  
    11object FormPlayers: TFormPlayers
    2   Left = 779
    3   Height = 360
    4   Top = 236
    5   Width = 480
     2  Left = 566
     3  Height = 354
     4  Top = 293
     5  Width = 682
    66  Caption = 'Players'
    7   ClientHeight = 360
    8   ClientWidth = 480
     7  ClientHeight = 354
     8  ClientWidth = 682
    99  DesignTimePPI = 144
    1010  OnClose = FormClose
     
    1515  object ListView1: TListView
    1616    Left = 0
    17     Height = 321
     17    Height = 315
    1818    Top = 0
    19     Width = 480
     19    Width = 682
    2020    Align = alClient
    2121    Columns = <   
     
    3030      item
    3131        Caption = 'Color'
     32        Width = 80
     33      end   
     34      item
     35        Caption = 'Nation'
    3236        Width = 100
    3337      end   
    3438      item
    3539        Caption = 'Start units'
    36         Width = 65
     40        Width = 187
    3741      end>
    3842    MultiSelect = True
     
    5357    Left = 0
    5458    Height = 39
    55     Top = 321
    56     Width = 480
     59    Top = 315
     60    Width = 682
    5761    Align = alBottom
    5862    Images = Core.ImageListSmall
  • trunk/Forms/UFormPlayers.pas

    r279 r282  
    131131    TempEntry.Id := Players.GetNewId;
    132132    TempEntry.Name := SPlayer + ' ' + IntToStr(TempEntry.Id);
    133     TempEntry.Color := PlayerColors[Players.Count];
     133    TempEntry.Nation := Core.Game.GameSystem.Nations.First;
     134    TempEntry.Color := TempEntry.Nation.Color;
    134135    TempEntry.Mode := pmComputer;
    135136    TempEntry.Agressivity := caMedium;
     
    204205    Item.SubItems.Add(PlayerModeText[Mode]);
    205206    Item.SubItems.Add(''); // Do not show color text
     207    if Assigned(Nation) then Item.SubItems.Add(Nation.Name)
     208      else Item.SubItems.Add('');
    206209    Item.SubItems.Add(IntToStr(StartUnits));
    207210  end;
Note: See TracChangeset for help on using the changeset viewer.