Changeset 275


Ignore:
Timestamp:
Feb 3, 2019, 11:28:03 PM (6 years ago)
Author:
chronos
Message:
  • Added: New forms for game systems management.
  • Added: Allow to load/save game system from/to file system as .xts file.
Location:
trunk
Files:
8 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormNew.lfm

    r274 r275  
    1818  object PageControl1: TPageControl
    1919    Left = 4
    20     Height = 692
    21     Top = 4
     20    Height = 636
     21    Top = 60
    2222    Width = 806
    23     ActivePage = TabSheetRules
     23    ActivePage = TabSheetMode
    2424    Align = alClient
    2525    BorderSpacing.Around = 4
    26     TabIndex = 3
     26    TabIndex = 0
    2727    TabOrder = 0
    2828    OnChange = PageControl1Change
    2929    object TabSheetMode: TTabSheet
    3030      Caption = 'Mode'
    31       ClientHeight = 652
     31      ClientHeight = 596
    3232      ClientWidth = 796
    3333      object Panel3: TPanel
    3434        Left = 0
    35         Height = 652
     35        Height = 596
    3636        Top = 0
    3737        Width = 796
    3838        Align = alClient
    3939        BevelOuter = bvNone
    40         ClientHeight = 652
     40        ClientHeight = 596
    4141        ClientWidth = 796
    4242        TabOrder = 0
     
    103103        object ListViewServers: TListView
    104104          Left = 26
    105           Height = 420
     105          Height = 364
    106106          Top = 181
    107107          Width = 334
     
    131131          Left = 27
    132132          Height = 31
    133           Top = 613
     133          Top = 557
    134134          Width = 94
    135135          Action = AServerAdd
     
    140140          Left = 240
    141141          Height = 31
    142           Top = 613
     142          Top = 557
    143143          Width = 94
    144144          Action = AServerRemove
     
    149149          Left = 136
    150150          Height = 30
    151           Top = 613
     151          Top = 557
    152152          Width = 94
    153153          Action = AServerModify
     
    159159    object TabSheetPlayers: TTabSheet
    160160      Caption = 'Players'
    161       ClientHeight = 652
     161      ClientHeight = 596
    162162      ClientWidth = 796
    163163      object Panel2: TPanel
     
    241241    object TabSheetMap: TTabSheet
    242242      Caption = 'Map'
    243       ClientHeight = 652
     243      ClientHeight = 596
    244244      ClientWidth = 796
    245245      OnShow = TabSheetMapShow
     
    542542    object TabSheetRules: TTabSheet
    543543      Caption = 'Rules'
    544       ClientHeight = 652
     544      ClientHeight = 596
    545545      ClientWidth = 796
    546546      object Panel4: TPanel
     
    754754  object PanelChat: TPanel
    755755    Left = 820
    756     Height = 700
    757     Top = 0
     756    Height = 644
     757    Top = 56
    758758    Width = 391
    759759    Align = alRight
     
    763763  object Splitter1: TSplitter
    764764    Left = 814
    765     Height = 700
    766     Top = 0
     765    Height = 644
     766    Top = 56
    767767    Width = 6
    768768    Align = alRight
    769769    ResizeAnchor = akRight
     770  end
     771  object Panel5: TPanel
     772    Left = 0
     773    Height = 56
     774    Top = 0
     775    Width = 1211
     776    Align = alTop
     777    BevelOuter = bvNone
     778    ClientHeight = 56
     779    ClientWidth = 1211
     780    TabOrder = 4
     781    object Label16: TLabel
     782      Left = 12
     783      Height = 26
     784      Top = 16
     785      Width = 121
     786      Caption = 'Game system:'
     787      ParentColor = False
     788    end
     789    object ComboBoxGameSystem: TComboBox
     790      Left = 176
     791      Height = 43
     792      Top = 9
     793      Width = 254
     794      ItemHeight = 0
     795      Style = csDropDownList
     796      TabOrder = 0
     797    end
     798    object ButtonGameSystems: TButton
     799      Left = 443
     800      Height = 38
     801      Top = 12
     802      Width = 113
     803      Caption = 'Manage'
     804      OnClick = ButtonGameSystemsClick
     805      TabOrder = 1
     806    end
    770807  end
    771808  object ActionList1: TActionList
  • trunk/Forms/UFormNew.pas

    r274 r275  
    2525    Button2: TButton;
    2626    Button3: TButton;
     27    ButtonGameSystems: TButton;
    2728    ButtonRandomize: TButton;
    2829    ButtonCancel: TButton;
     
    4142    CheckBoxUnitsMoveImmediately: TCheckBox;
    4243    CheckBoxVoid: TCheckBox;
     44    ComboBoxGameSystem: TComboBox;
    4345    ComboBoxGridType: TComboBox;
    4446    ComboBoxMapShape: TComboBox;
     
    5456    Label14: TLabel;
    5557    Label15: TLabel;
     58    Label16: TLabel;
    5659    Label2: TLabel;
    5760    Label3: TLabel;
     
    117120    procedure AServerModifyExecute(Sender: TObject);
    118121    procedure AServerRemoveExecute(Sender: TObject);
     122    procedure ButtonGameSystemsClick(Sender: TObject);
    119123    procedure ButtonImageBrowseClick(Sender: TObject);
    120124    procedure ButtonRandomizeClick(Sender: TObject);
     
    169173    procedure MapPreviewPaint;
    170174    procedure MapPreviewRedraw;
     175    procedure ReloadGameSystemsMenu;
    171176  public
    172177    procedure Translate;
     
    186191
    187192uses
    188   UFormPlayer, UFormChat, UCore, UFormServer, UClientGUI, UFormClient;
     193  UFormPlayer, UFormChat, UCore, UFormServer, UClientGUI, UFormClient,
     194  UFormGameSystems;
    189195
    190196resourcestring
     
    403409end;
    404410
     411procedure TFormNew.ReloadGameSystemsMenu;
     412var
     413  I: Integer;
     414  LastSystem: Pointer;
     415begin
     416  if ComboBoxGameSystem.ItemIndex <> -1 then
     417    LastSystem := ComboBoxGameSystem.Items.Objects[ComboBoxGameSystem.ItemIndex]
     418    else LastSystem := nil;
     419  ComboBoxGameSystem.Items.BeginUpdate;
     420  try
     421    while ComboBoxGameSystem.Items.Count > Core.GameSystems.Count do
     422      ComboBoxGameSystem.Items.Delete(ComboBoxGameSystem.Items.Count - 1);
     423    while ComboBoxGameSystem.Items.Count < Core.GameSystems.Count do
     424      ComboBoxGameSystem.Items.Add('');
     425    for I := 0 to Core.GameSystems.Count - 1 do begin
     426      ComboBoxGameSystem.Items[I] := Core.GameSystems[I].Name;
     427      ComboBoxGameSystem.Items.Objects[I] := Core.GameSystems[I];
     428    end;
     429    if Assigned(LastSystem) then
     430      ComboBoxGameSystem.ItemIndex := ComboBoxGameSystem.Items.IndexOfObject(LastSystem);
     431    if (ComboBoxGameSystem.ItemIndex = -1) and (ComboBoxGameSystem.Items.Count > 0) then
     432      ComboBoxGameSystem.ItemIndex := 0;
     433  finally
     434    ComboBoxGameSystem.Items.EndUpdate;
     435  end;
     436end;
     437
    405438procedure TFormNew.MapPreviewPaint;
    406439var
     
    525558  Core.PersistentForm.Load(Self);
    526559  Core.ThemeManager1.UseTheme(Self);
     560  ReloadGameSystemsMenu;
    527561  ReloadView;
    528562  //Height := Trunc(1.5 * Height);
     
    678712      ServerList.Items.Delete(I);
    679713    ReloadView;
     714  end;
     715end;
     716
     717procedure TFormNew.ButtonGameSystemsClick(Sender: TObject);
     718begin
     719  FormGameSystems := TFormGameSystems.Create(nil);
     720  try
     721    FormGameSystems.GameSystems := Core.GameSystems;
     722    FormGameSystems.ShowModal;
     723    ReloadGameSystemsMenu;
     724  finally
     725    FreeAndNil(FormGameSystems);
    680726  end;
    681727end;
  • trunk/Languages/xtactics.cs.po

    r274 r275  
    4040
    4141#: tcore.agameload.caption
     42msgctxt "tcore.agameload.caption"
    4243msgid "Load"
    4344msgstr "Načíst"
     
    6364
    6465#: tcore.agamesave.caption
     66msgctxt "tcore.agamesave.caption"
    6567msgid "Save"
    6668msgstr "Uložit"
     
    203205msgid "Client"
    204206msgstr "Klient"
     207
     208#: tformgamesystem.buttoncancel.caption
     209msgctxt "tformgamesystem.buttoncancel.caption"
     210msgid "Cancel"
     211msgstr "Zrušit"
     212
     213#: tformgamesystem.buttonload.caption
     214msgctxt "tformgamesystem.buttonload.caption"
     215msgid "Load"
     216msgstr "Načíst"
     217
     218#: tformgamesystem.buttonok.caption
     219msgctxt "tformgamesystem.buttonok.caption"
     220msgid "OK"
     221msgstr "OK"
     222
     223#: tformgamesystem.buttonsave.caption
     224msgctxt "tformgamesystem.buttonsave.caption"
     225msgid "Save"
     226msgstr "Uložit"
     227
     228#: tformgamesystem.caption
     229msgid "Game system"
     230msgstr "Herní systém"
     231
     232#: tformgamesystems.aadd.caption
     233msgctxt "tformgamesystems.aadd.caption"
     234msgid "Add"
     235msgstr "Přidat"
     236
     237#: tformgamesystems.aclone.caption
     238msgid "Clone"
     239msgstr "Klonovat"
     240
     241#: tformgamesystems.amodify.caption
     242msgctxt "tformgamesystems.amodify.caption"
     243msgid "Modify"
     244msgstr "Upravit"
     245
     246#: tformgamesystems.aremove.caption
     247msgctxt "tformgamesystems.aremove.caption"
     248msgid "Remove"
     249msgstr "Odstranit"
     250
     251#: tformgamesystems.aselectall.caption
     252msgid "Select all"
     253msgstr "Vybrat vše"
     254
     255#: tformgamesystems.caption
     256msgid "Game systems"
     257msgstr "Herní systémy"
     258
     259#: tformgamesystems.listview1.columns[0].caption
     260msgctxt "tformgamesystems.listview1.columns[0].caption"
     261msgid "Name"
     262msgstr "Jméno"
    205263
    206264#: tformhelp.caption
     
    395453msgstr "Zrušit"
    396454
     455#: tformnew.buttongamesystems.caption
     456msgid "Manage"
     457msgstr "Spravovat"
     458
    397459#: tformnew.buttonimagebrowse.caption
    398460msgctxt "tformnew.buttonimagebrowse.caption"
     
    482544msgstr "Náhled:"
    483545
     546#: tformnew.label16.caption
     547msgid "Game system:"
     548msgstr "Herní systém:"
     549
    484550#: tformnew.label2.caption
    485551#| msgid "x"
     
    682748
    683749#: tformserver.buttonok.caption
     750msgctxt "tformserver.buttonok.caption"
    684751msgid "OK"
    685752msgstr "OK"
     
    884951msgid "turn"
    885952msgstr "tah"
     953
     954#: uformgamesystem.sfiledialogfilter
     955msgid "xTactics game system (.xts)|*.xts|All files|*.*"
     956msgstr "xTactics herní systém (.xts)|*.xts|Všechny soubory|*.*"
     957
     958#: uformgamesystems.sremoveitems
     959msgid "Remove items"
     960msgstr "Odstranit položky"
     961
     962#: uformgamesystems.sremoveitemsquery
     963msgid "Do you want to remove selected items?"
     964msgstr "Opravdu chcete odstranit vybrané položky?"
    886965
    887966#: uformhelp.scontent
     
    10581137
    10591138#: ugame.swrongfileformat
     1139msgctxt "ugame.swrongfileformat"
     1140msgid "Wrong file format"
     1141msgstr "Chybný formát souboru"
     1142
     1143#: ugamesystem.swrongfileformat
     1144msgctxt "ugamesystem.swrongfileformat"
    10601145msgid "Wrong file format"
    10611146msgstr "Chybný formát souboru"
  • trunk/Languages/xtactics.po

    r274 r275  
    3030
    3131#: tcore.agameload.caption
     32msgctxt "tcore.agameload.caption"
    3233msgid "Load"
    3334msgstr ""
     
    5354
    5455#: tcore.agamesave.caption
     56msgctxt "tcore.agamesave.caption"
    5557msgid "Save"
    5658msgstr ""
     
    194196msgstr ""
    195197
     198#: tformgamesystem.buttoncancel.caption
     199msgctxt "tformgamesystem.buttoncancel.caption"
     200msgid "Cancel"
     201msgstr ""
     202
     203#: tformgamesystem.buttonload.caption
     204msgctxt "tformgamesystem.buttonload.caption"
     205msgid "Load"
     206msgstr ""
     207
     208#: tformgamesystem.buttonok.caption
     209msgctxt "tformgamesystem.buttonok.caption"
     210msgid "OK"
     211msgstr ""
     212
     213#: tformgamesystem.buttonsave.caption
     214msgctxt "tformgamesystem.buttonsave.caption"
     215msgid "Save"
     216msgstr ""
     217
     218#: tformgamesystem.caption
     219msgid "Game system"
     220msgstr ""
     221
     222#: tformgamesystems.aadd.caption
     223msgctxt "tformgamesystems.aadd.caption"
     224msgid "Add"
     225msgstr ""
     226
     227#: tformgamesystems.aclone.caption
     228msgid "Clone"
     229msgstr ""
     230
     231#: tformgamesystems.amodify.caption
     232msgctxt "tformgamesystems.amodify.caption"
     233msgid "Modify"
     234msgstr ""
     235
     236#: tformgamesystems.aremove.caption
     237msgctxt "tformgamesystems.aremove.caption"
     238msgid "Remove"
     239msgstr ""
     240
     241#: tformgamesystems.aselectall.caption
     242msgid "Select all"
     243msgstr ""
     244
     245#: tformgamesystems.caption
     246msgid "Game systems"
     247msgstr ""
     248
     249#: tformgamesystems.listview1.columns[0].caption
     250msgctxt "tformgamesystems.listview1.columns[0].caption"
     251msgid "Name"
     252msgstr ""
     253
    196254#: tformhelp.caption
    197255msgctxt "TFORMHELP.CAPTION"
     
    382440msgstr ""
    383441
     442#: tformnew.buttongamesystems.caption
     443msgid "Manage"
     444msgstr ""
     445
    384446#: tformnew.buttonimagebrowse.caption
    385447msgctxt "TFORMNEW.BUTTONIMAGEBROWSE.CAPTION"
     
    468530msgstr ""
    469531
     532#: tformnew.label16.caption
     533msgid "Game system:"
     534msgstr ""
     535
    470536#: tformnew.label2.caption
    471537msgid "Map height:"
     
    667733
    668734#: tformserver.buttonok.caption
     735msgctxt "tformserver.buttonok.caption"
    669736msgid "OK"
    670737msgstr ""
     
    868935msgctxt "uformclient.sturn"
    869936msgid "turn"
     937msgstr ""
     938
     939#: uformgamesystem.sfiledialogfilter
     940msgid "xTactics game system (.xts)|*.xts|All files|*.*"
     941msgstr ""
     942
     943#: uformgamesystems.sremoveitems
     944msgid "Remove items"
     945msgstr ""
     946
     947#: uformgamesystems.sremoveitemsquery
     948msgid "Do you want to remove selected items?"
    870949msgstr ""
    871950
     
    10351114
    10361115#: ugame.swrongfileformat
     1116msgctxt "ugame.swrongfileformat"
     1117msgid "Wrong file format"
     1118msgstr ""
     1119
     1120#: ugamesystem.swrongfileformat
     1121msgctxt "ugamesystem.swrongfileformat"
    10371122msgid "Wrong file format"
    10381123msgstr ""
  • trunk/UClientGUI.pas

    r274 r275  
    153153      Pen.Width := Round(10 * View.Zoom);
    154154      Brush.Style := bsClear;
    155       TCanvasEx.Ellipse(Canvas, TRect.Create(
     155      TCanvasEx.EllipseEx(Canvas, TRect.Create(
    156156        TPoint.Create(TextPos.X - R, TextPos.Y - R),
    157157        TPoint.Create(TextPos.X + R, TextPos.Y + R)
     
    221221      Pen.Width := Round(10 * View.Zoom);
    222222      Brush.Style := bsClear;
    223       TCanvasEx.Ellipse(Canvas, TRect.Create(
     223      TCanvasEx.EllipseEx(Canvas, TRect.Create(
    224224        TPoint.Create(TextPos.X - R, TextPos.Y - R),
    225225        TPoint.Create(TextPos.X + R, TextPos.Y + R)
  • trunk/UCore.lfm

    r264 r275  
    117117    top = 420
    118118    Bitmap = {
    119       4C691000000010000000100000000000000000000000E3AA4BD6E5B35EFFE3B1
     119      4C691300000010000000100000000000000000000000E3AA4BD6E5B35EFFE3B1
    120120      61F2DEA85AF3D9A156F3D49B50F3CF904AF3CA8C47F3C58743F3C0813CF3BF80
    121121      38F8A75E20FB00000000000000000000000000000000E6AF53E7F6D084FFF8D8
     
    629629      21FF77461EFF75421BFF75421BFFFFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
    630630      FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
    631       FF00FFFFFF00FFFFFF00FFFFFF00
     631      FF00FFFFFF00FFFFFF00FFFFFF00000000000000000000000000000000000000
     632      000070A970FF006400FF006200FF70A670FF0000000000000000000000000000
     633      0000000000000000000000000000000000000000000000000000000000000000
     634      0000006400FFECFFECFF8CFE8CFF006000FFD4D4D4FF00000000000000000000
     635      0000000000000000000000000000000000000000000000000000000000000000
     636      0000006400FF8CFE8CFF00E800FF005E00FFB2B2B2FF00000000000000000000
     637      0000000000000000000000000000000000000000000000000000000000000000
     638      0000006200FF8CFE8CFF00E500FF005C00FFB2B2B2FF00000000000000000000
     639      0000000000000000000000000000000000000000000000000000000000000000
     640      0000006000FF8CFE8CFF00E000FF005A00FFB2B2B2FF00000000000000000000
     641      000000000000000000000000000070A970FF006400FF006400FF006200FF0060
     642      00FF006000FF8CFE8CFF00DD00FF005800FF005600FF005400FF005300FF0050
     643      00FF709C70FF0000000000000000006400FFECFFECFF8CFE8CFF8CFE8CFF8CFE
     644      8CFF8CFE8CFF00DE00FF00D900FF00D400FF00D000FF00CC00FF00C800FF00C4
     645      00FF004A00FFD4D4D4FF00000000006200FF8CFE8CFF00EA00FF00E600FF00E2
     646      00FF00DE00FF00DA00FF00D400FF00D000FF00CC00FF00C800FF00C400FF00C2
     647      00FF004800FFB2B2B2FF0000000070A670FF005E00FF005C00FF005A00FF0058
     648      00FF005600FF00D600FF00D000FF005000FF004E00FF004C00FF004A00FF004A
     649      00FF4E764EFFB2B2B2FF0000000000000000D4D4D4FFB2B2B2FFB2B2B2FFB2B2
     650      B2FF005400FF00D200FF00CE00FF004E00FFB2B2B2FFB2B2B2FFB2B2B2FFB2B2
     651      B2FFB2B2B2FFD4D4D4FF00000000000000000000000000000000000000000000
     652      0000005300FF00CE00FF00CA00FF004C00FFB2B2B2FF00000000000000000000
     653      0000000000000000000000000000000000000000000000000000000000000000
     654      0000005000FF00CA00FF00C600FF004A00FFB2B2B2FF00000000000000000000
     655      0000000000000000000000000000000000000000000000000000000000000000
     656      0000004E00FF00C800FF00C400FF004800FFB2B2B2FF00000000000000000000
     657      0000000000000000000000000000000000000000000000000000000000000000
     658      0000709B70FF004A00FF004800FF4E764EFFB2B2B2FF00000000000000000000
     659      0000000000000000000000000000000000000000000000000000000000000000
     660      000000000000D4D4D4FFB2B2B2FFB2B2B2FFD4D4D4FF00000000000000000000
     661      0000000000000000000000000000000000000000000000000000000000000000
     662      0000000000000000000000000000000000000000000000000000000000000000
     663      0000000000000000000000000000000000000000000000000000000000000000
     664      0000000000000000000000000000000000000000000000000000000000000000
     665      0000000000000000000000000000000000000000000000000000000000000000
     666      00000000000000000000D69562FFD69562FFD69562FFD1925FFFD1925FFFD192
     667      5FFFD1925FFFD1925FFF875735FF000000000000000000000000000000000000
     668      00000000000000000000D69562FFF5F5F5FFF5F5F5FFF5F5F5FFF5F5F5FFF5F5
     669      F5FFF5F5F5FFF5F5F5FF875735FF000000000000000000000000000000000000
     670      00000000000000000000D69562FFFAFAFAFFFFEDE0FFFFEDE0FFFFEDE0FFFFED
     671      E0FFFFEDE0FFFFFFFFFF875735FF000000000000000000000000000000000000
     672      00000000000000000000EED4BFFFFFFFFFFFE0D5BFFFE4D9C3FFCCB27EFFFFED
     673      E0FFFFEDE0FFFFFFFFFF875735FF00000000D69562FFD69562FFD69562FFD192
     674      5FFFD1925FFFD1925FFFD1925FFFD1925FFF875735FFFFF7F2FFFFECDEFFFFEC
     675      DEFFFFECDDFFFFFFFFFF875735FF00000000D69562FFF5F5F5FFF5F5F5FFF5F5
     676      F5FFF5F5F5FFF5F5F5FFF5F5F5FFF5F5F5FF875735FFE4D9C3FFCCB27EFFD5BC
     677      87FFDDC490FFFFFFFFFF875735FF00000000D69562FFFAFAFAFFFFEDE0FFFFED
     678      E0FFFFEDE0FFFFEDE0FFFFEDE0FFFFFFFFFF875735FFFFF6EFFFFFE8D7FFFFE8
     679      D7FFFFE8D7FFFFFFFFFF875735FF00000000D49360FFFFFFFFFFB2955FFFBB9F
     680      69FFCCB27EFFFFEDE0FFFFEDE0FFFFFFFFFF875735FFE4D9C3FFCCB27EFFD5BC
     681      87FFDDC490FFFFFFFFFF875735FF00000000D0905EFFFFFFFFFFFFECDEFFFFEC
     682      DEFFFFECDEFFFFECDEFFFFECDDFFFFFFFFFF875735FFFFF6EFFFFFE8D7FFFFE8
     683      D7FFFFE8D7FFFFFFFFFF875735FF00000000CC8D5CFFFFFFFFFFB2955FFFBB9F
     684      69FFCCB27EFFD5BC87FFDDC490FFFFFFFFFF875735FFFFFFFFFFFFFFFFFFFFFF
     685      FFFFFFFFFFFFFFFFFFFF875735FF00000000C18556FFFFFFFFFFFFE8D7FFFFE8
     686      D7FFFFE8D7FFFFE8D7FFFFE8D7FFFFFFFFFF875735FFCFBCAEFF875735FF8757
     687      35FF875735FF875735FF875735FF00000000C18556FFFFFFFFFFB2955FFFBB9F
     688      69FFCCB27EFFD5BC87FFDDC490FFFFFFFFFF875735FF00000000000000000000
     689      000000000000000000000000000000000000C18556FFFFFFFFFFFFE8D7FFFFE8
     690      D7FFFFE8D7FFFFE8D7FFFFE8D7FFFFFFFFFF875735FF00000000000000000000
     691      000000000000000000000000000000000000C18556FFFFFFFFFFFFFFFFFFFFFF
     692      FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF875735FF00000000000000000000
     693      000000000000000000000000000000000000875735FF875735FF875735FF8757
     694      35FF875735FF875735FF875735FF875735FF875735FF00000000000000000000
     695      0000000000000000000000000000000000000000000000000000000000000000
     696      0000000000000000000000000000000000000000000000000000000000000000
     697      000000000000000000000000000000000000000000008C8CBBFF000088FF8C8C
     698      BBFF00000000000000000000000000000000000000008C8CBBFF000075FF8C8C
     699      BBFF000000000000000000000000000000008C8CBBFF000088FF619BFFFF0000
     700      86FF7979A8FF0000000000000000000000008C8CBBFF000075FF619BFFFF0000
     701      6EFF7979A8FF000000000000000000000000000088FF619BFFFF0057FFFF0054
     702      FFFF000082FF7979A8FF000000008C8CBBFF000075FF619BFFFF003AFFFF0035
     703      FFFF000068FFDCDCDCFF00000000000000008C8CBBFF000086FF0054FFFF0052
     704      FFFF004EFFFF00007CFF7979A8FF000075FF619BFFFF003AFFFF0035FFFF0000
     705      67FF626291FFB2B2B2FF0000000000000000000000007979A8FF000082FF004E
     706      FFFF004BFFFF0047FFFF000075FF619BFFFF003AFFFF0035FFFF000068FF6262
     707      91FFB2B2B2FFDCDCDCFF000000000000000000000000000000007979A8FF0000
     708      7CFF0047FFFF0042FFFF003EFFFF003AFFFF0035FFFF000068FF626291FFB2B2
     709      B2FFDCDCDCFF0000000000000000000000000000000000000000000000007979
     710      A8FF000075FF003EFFFF003AFFFF0035FFFF000068FF626291FFB2B2B2FFDCDC
     711      DCFF0000000000000000000000000000000000000000000000008C8CBBFF0000
     712      75FF619BFFFF003AFFFF0035FFFF0030FFFF002BFFFF000061FF7979A8FF0000
     713      000000000000000000000000000000000000000000008C8CBBFF000075FF619B
     714      FFFF003AFFFF0035FFFF000067FF002CFFFF0027FFFF0023FFFF000059FF7979
     715      A8FF000000000000000000000000000000008C8CBBFF000075FF619BFFFF003A
     716      FFFF0035FFFF000067FF626291FF000061FF0023FFFF001FFFFF001BFFFF0000
     717      54FF7979A8FF000000000000000000000000000072FF619BFFFF003AFFFF0035
     718      FFFF000067FF626291FFB2B2B2FF7979A8FF000059FF001BFFFF0018FFFF0015
     719      FFFF000050FFDCDCDCFF00000000000000008C8CBBFF00006EFF0035FFFF0000
     720      68FF626291FFB2B2B2FFDCDCDCFF000000007979A8FF000054FF0015FFFF0000
     721      50FF626291FFB2B2B2FF0000000000000000000000007979A8FF000067FF6262
     722      91FFB2B2B2FFDCDCDCFF0000000000000000000000007979A8FF000050FF6262
     723      91FFB2B2B2FFDCDCDCFF00000000000000000000000000000000DCDCDCFFB2B2
     724      B2FFDCDCDCFF0000000000000000000000000000000000000000DCDCDCFFB2B2
     725      B2FFDCDCDCFF0000000000000000000000000000000000000000000000000000
     726      0000000000000000000000000000000000000000000000000000000000000000
     727      0000000000000000000000000000
    632728    }
    633729  end
  • trunk/UCore.pas

    r274 r275  
    760760
    761761    GameSettings.LoadConfig(XMLConfig1, 'Game');
     762    GameSettings.GameSystem := GameSystems.SearchByName(GameSettings.GameSystemName);
     763    if not Assigned(GameSettings.GameSystem) then
     764      GameSettings.GameSystem := GameSystems.First;
    762765    Server.LoadConfig(XMLConfig1, 'Server');
    763766    ServerList.LoadConfig(XmlConfig1, 'ServerList');
  • trunk/UGame.pas

    r274 r275  
    2424    class procedure PolygonEx(Canvas: TCanvas; const Points: array of Classes.TPoint; Winding: Boolean);
    2525    class procedure PolyLineEx(Canvas: TCanvas; const Points: array of Classes.TPoint);
    26     class procedure Ellipse(Canvas: TCanvas; const ARect: TRect);
     26    class procedure EllipseEx(Canvas: TCanvas; const ARect: TRect);
    2727  end;
    2828
     
    8787    StoredRandSeed: Cardinal;
    8888    GeneratePlayers: Boolean;
     89    GameSystemName: string;
    8990    procedure PostConfig;
    9091    procedure Assign(Source: TGame);
     
    192193end;
    193194
    194 class procedure TCanvasEx.Ellipse(Canvas: TCanvas; const ARect: TRect);
     195class procedure TCanvasEx.EllipseEx(Canvas: TCanvas; const ARect: TRect);
    195196begin
    196197  LCLIntf.Ellipse(Canvas.Handle, ARect.P1.X, ARect.P1.Y, ARect.P2.X, ARect.P2.Y);
     
    526527    SetValue(DOMString(Path + '/MaxPower'), MaxPower);
    527528    Players.SaveConfig(Config, Path + '/Players');
    528     GameSystem.SaveConfig(Config, Path + '/GameSystem');
     529    SetValue(DOMString(Path + '/GameSystemName'), DOMString(GameSystemName));
    529530  end;
    530531end;
     
    565566    MaxPower := GetValue(DOMString(Path + '/MaxPower'), 99);
    566567    Players.LoadConfig(Config, Path + '/Players');
    567     GameSystem.LoadConfig(Config, Path + '/GameSystem');
     568    GameSystemName := string(GetValue(DOMString(Path + '/GameSystemName'), DOMString('')));
    568569  end;
    569570end;
     
    788789  R: Boolean;
    789790  I: Integer;
    790   PlayersCount: Integer;
    791791begin
    792792  Winner := nil;
  • trunk/UGameSystem.pas

    r274 r275  
    66
    77uses
    8   Classes, SysUtils, fgl, UUnit, DOM, UXMLUtils, XMLConf;
     8  Classes, SysUtils, fgl, UUnit, DOM, XMLRead, XMLWrite, UXMLUtils, XMLConf;
    99
    1010type
     
    2020    EmptyCellsNeutral: Boolean;
    2121    UnitsMoveImmediately: Boolean;
     22    FileName: string;
    2223    constructor Create;
    2324    destructor Destroy; override;
     25    procedure Clear;
    2426    procedure Assign(Source: TGameSystem);
    2527    procedure LoadFromNode(Node: TDOMNode);
     
    3537  TGameSystems = class(TFPGObjectList<TGameSystem>)
    3638    function AddNew(Name: string): TGameSystem;
     39    function SearchByName(Name: string): TGameSystem;
    3740  end;
    3841
     42
    3943implementation
     44
     45resourcestring
     46  SWrongFileFormat = 'Wrong file format';
    4047
    4148{ TGameSystems }
     
    4653  Result.Name := Name;
    4754  Add(Result);
     55end;
     56
     57function TGameSystems.SearchByName(Name: string): TGameSystem;
     58var
     59  I: Integer;
     60begin
     61  I := 0;
     62  while (I < Count) and (Items[I].Name <> Name) do Inc(I);
     63  if I < Count then Result := Items[I]
     64    else Result := nil;
    4865end;
    4966
     
    5976  UnitKinds.Free;
    6077  inherited Destroy;
     78end;
     79
     80procedure TGameSystem.Clear;
     81begin
     82  UnitKinds.Clear;
    6183end;
    6284
     
    99121
    100122procedure TGameSystem.LoadFromFile(FileName: string);
     123var
     124  Doc: TXMLDocument;
     125  RootNode: TDOMNode;
    101126begin
    102 
     127  ReadXMLFile(Doc, FileName);
     128  Self.FileName := FileName;
     129  Clear;
     130  with Doc do try
     131    if Doc.DocumentElement.NodeName <> 'XtacticsRules' then
     132      raise Exception.Create(SWrongFileFormat);
     133    RootNode := Doc.DocumentElement;
     134    LoadFromNode(RootNode);
     135  finally
     136    FreeAndNil(Doc);
     137  end;
    103138end;
    104139
    105140procedure TGameSystem.SaveToFile(FileName: string);
     141var
     142  Doc: TXMLDocument;
     143  RootNode: TDOMNode;
    106144begin
    107 
     145  Self.FileName := FileName;
     146  Doc := TXMLDocument.Create;
     147  with Doc do try
     148    RootNode := CreateElement('XtacticsRules');
     149    AppendChild(RootNode);
     150    SaveToNode(RootNode);
     151    if ExtractFileDir(FileName) <> '' then
     152      ForceDirectories(ExtractFileDir(FileName));
     153    WriteXMLFile(Doc, FileName);
     154  finally
     155    FreeAndNil(Doc);
     156  end;
    108157end;
    109158
  • trunk/xtactics.lpi

    r265 r275  
    109109      </Item7>
    110110    </RequiredPackages>
    111     <Units Count="36">
     111    <Units Count="38">
    112112      <Unit0>
    113113        <Filename Value="xtactics.lpr"/>
     
    299299        <IsPartOfProject Value="True"/>
    300300      </Unit35>
     301      <Unit36>
     302        <Filename Value="Forms/UFormGameSystem.pas"/>
     303        <IsPartOfProject Value="True"/>
     304        <ComponentName Value="FormGameSystem"/>
     305        <ResourceBaseClass Value="Form"/>
     306      </Unit36>
     307      <Unit37>
     308        <Filename Value="Forms/UFormGameSystems.pas"/>
     309        <IsPartOfProject Value="True"/>
     310        <ComponentName Value="FormGameSystems"/>
     311        <ResourceBaseClass Value="Form"/>
     312      </Unit37>
    301313    </Units>
    302314  </ProjectOptions>
Note: See TracChangeset for help on using the changeset viewer.