Changeset 70


Ignore:
Timestamp:
Sep 28, 2014, 6:04:57 PM (10 years ago)
Author:
chronos
Message:
  • Added: Support for symetric map usable for two players game.
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormNew.lfm

    r55 r70  
    11object FormNew: TFormNew
    2   Left = 706
     2  Left = 440
    33  Height = 614
    4   Top = 455
     4  Top = 178
    55  Width = 716
    66  Caption = 'New game'
     
    127127    object CheckBoxVoid: TCheckBox
    128128      Left = 8
    129       Height = 27
     129      Height = 24
    130130      Top = 101
    131       Width = 198
     131      Width = 175
    132132      Caption = 'Inaccessible places'
    133133      OnChange = CheckBoxVoidChange
     
    136136    object Label1: TLabel
    137137      Left = 8
    138       Height = 25
     138      Height = 22
    139139      Top = 9
    140       Width = 104
     140      Width = 88
    141141      Caption = 'Map width:'
    142142      ParentColor = False
     
    144144    object SpinEditMapSizeX: TSpinEdit
    145145      Left = 128
    146       Height = 35
     146      Height = 32
    147147      Top = 4
    148148      Width = 98
     
    154154    object SpinEditMapSizeY: TSpinEdit
    155155      Left = 128
    156       Height = 35
     156      Height = 32
    157157      Top = 55
    158158      Width = 98
     
    164164    object SpinEditVoidPercent: TSpinEdit
    165165      Left = 216
    166       Height = 35
     166      Height = 32
    167167      Top = 97
    168168      Width = 106
     
    173173    object Label3: TLabel
    174174      Left = 331
    175       Height = 25
     175      Height = 22
    176176      Top = 102
    177       Width = 17
     177      Width = 15
    178178      Caption = '%'
    179179      ParentColor = False
     
    207207    object Label2: TLabel
    208208      Left = 8
    209       Height = 25
     209      Height = 22
    210210      Top = 57
    211       Width = 110
     211      Width = 94
    212212      Caption = 'Map height:'
    213213      ParentColor = False
     
    215215    object CheckBoxCity: TCheckBox
    216216      Left = 8
    217       Height = 27
     217      Height = 24
    218218      Top = 141
    219       Width = 73
     219      Width = 68
    220220      Caption = 'Cities'
    221221      OnChange = CheckBoxCityChange
     
    224224    object SpinEditCityPercent: TSpinEdit
    225225      Left = 216
    226       Height = 35
     226      Height = 32
    227227      Top = 137
    228228      Width = 106
     
    233233    object Label4: TLabel
    234234      Left = 331
    235       Height = 25
     235      Height = 22
    236236      Top = 142
    237       Width = 17
     237      Width = 15
    238238      Caption = '%'
    239239      ParentColor = False
     
    253253      ChildSizing.Layout = cclLeftToRightThenTopToBottom
    254254      ChildSizing.ControlsPerLine = 1
    255       ClientHeight = 49
     255      ClientHeight = 52
    256256      ClientWidth = 301
    257257      Items.Strings = (
     
    275275      ChildSizing.Layout = cclLeftToRightThenTopToBottom
    276276      ChildSizing.ControlsPerLine = 1
    277       ClientHeight = 78
     277      ClientHeight = 81
    278278      ClientWidth = 308
    279279      Items.Strings = (
     
    286286    object ComboBoxGridType: TComboBox
    287287      Left = 473
    288       Height = 33
     288      Height = 30
    289289      Top = 201
    290290      Width = 208
     
    300300    object Label5: TLabel
    301301      Left = 336
    302       Height = 25
     302      Height = 22
    303303      Top = 201
    304       Width = 90
     304      Width = 79
    305305      Caption = 'Grid type:'
    306306      ParentColor = False
     
    308308    object Label6: TLabel
    309309      Left = 8
    310       Height = 25
     310      Height = 22
    311311      Top = 313
    312       Width = 129
     312      Width = 114
    313313      Caption = 'Win objective:'
    314314      ParentColor = False
     
    316316    object ComboBoxWinObjective: TComboBox
    317317      Left = 232
    318       Height = 33
     318      Height = 30
    319319      Top = 305
    320320      Width = 328
     
    331331    object Label7: TLabel
    332332      Left = 8
    333       Height = 25
     333      Height = 22
    334334      Top = 348
    335       Width = 245
     335      Width = 211
    336336      Caption = 'Max random neutral units:'
    337337      ParentColor = False
     
    339339    object SpinEditNeutralUnits: TSpinEdit
    340340      Left = 384
    341       Height = 35
     341      Height = 32
    342342      Top = 344
    343343      Width = 98
     
    346346      TabOrder = 14
    347347      Value = 12
     348    end
     349    object CheckBoxSymetricMap: TCheckBox
     350      Left = 334
     351      Height = 24
     352      Top = 238
     353      Width = 133
     354      Caption = 'Symetric map'
     355      TabOrder = 15
    348356    end
    349357  end
  • trunk/Forms/UFormNew.lrt

    r42 r70  
    2020TFORMNEW.LABEL6.CAPTION=Win objective:
    2121TFORMNEW.LABEL7.CAPTION=Max random neutral units:
     22TFORMNEW.CHECKBOXSYMETRICMAP.CAPTION=Symetric map
    2223TFORMNEW.APLAYERMODIFY.CAPTION=Modify player
    2324TFORMNEW.APLAYERADD.CAPTION=Add player
  • trunk/Forms/UFormNew.pas

    r55 r70  
    2323    ButtonPlayerModify: TButton;
    2424    ButtonPlayerRemove: TButton;
     25    CheckBoxSymetricMap: TCheckBox;
    2526    CheckBoxCity: TCheckBox;
    2627    CheckBoxVoid: TCheckBox;
     
    271272  NewItem: TListItem;
    272273begin
     274  CheckBoxSymetricMap.Checked := Game.SymetricMap;
    273275  CheckBoxVoid.Checked := Game.VoidEnabled;
    274276  SpinEditVoidPercent.Value := Game.VoidPercentage;
     
    306308    TPlayer(Game.Players[I]).Game := Game;
    307309  end;
     310  Game.SymetricMap := CheckBoxSymetricMap.Checked;
    308311  Game.VoidEnabled := CheckBoxVoid.Checked;
    309312  Game.VoidPercentage := SpinEditVoidPercent.Value;
  • trunk/Languages/xtactics.cs.po

    r68 r70  
    241241msgstr "Města"
    242242
     243#: tformnew.checkboxsymetricmap.caption
     244msgid "Symetric map"
     245msgstr ""
     246
    243247#: tformnew.checkboxvoid.caption
    244248msgid "Inaccessible places"
  • trunk/Languages/xtactics.po

    r68 r70  
    231231msgstr ""
    232232
     233#: tformnew.checkboxsymetricmap.caption
     234msgid "Symetric map"
     235msgstr ""
     236
    233237#: tformnew.checkboxvoid.caption
    234238msgid "Inaccessible places"
  • trunk/UGame.pas

    r69 r70  
    190190    TotalCities: Integer;
    191191    StartUnits: Integer;
     192    StartCell: TCell;
    192193    procedure LoadFromNode(Node: TDOMNode);
    193194    procedure SaveToNode(Node: TDOMNode);
     
    278279    VoidEnabled: Boolean;
    279280    VoidPercentage: Integer;
     281    SymetricMap: Boolean;
    280282    GrowCells: TGrowCells;
    281283    GrowAmount: TGrowAmount;
     
    291293    FileName: string;
    292294    function AttackProbability(AttackCount, DefendCount, Depth: Integer): Double;
     295    procedure LoadConfig(Config: TXmlConfig; Path: string);
    293296    procedure SaveConfig(Config: TXmlConfig; Path: string);
    294     procedure LoadConfig(Config: TXmlConfig; Path: string);
    295297    procedure LoadFromFile(FileName: string);
    296298    procedure SaveToFile(FileName: string);
     
    14001402  View := TView.Create;
    14011403  StartUnits := DefaultPlayerStartUnits;
     1404  StartCell := nil;
    14021405end;
    14031406
     
    14171420  TotalUnits := Source.TotalUnits;
    14181421  StartUnits := Source.StartUnits;
     1422  StartCell := Source.StartCell;
    14191423  View.Assign(Source.View);
    14201424end;
     
    14311435  AttackerDiceCount: Integer;
    14321436  DefenderDiceCount: Integer;
    1433   AttackerHighestRoll: Integer;
    1434   DefenderHighestRoll: Integer;
    1435   RollResult: Integer;
    14361437  S: string;
    14371438  I: Integer;
     
    16861687  with Config do begin
    16871688    SetValue(Path + '/GridType', Integer(MapType));
     1689    SetValue(Path + '/SymetricMap', SymetricMap);
    16881690    SetValue(Path + '/VoidEnabled', VoidEnabled);
    16891691    SetValue(Path + '/VoidPercentage', VoidPercentage);
     
    17041706  with Config do begin
    17051707    MapType := TMapType(GetValue(Path + '/GridType', Integer(mtHexagon)));
     1708    SymetricMap := GetValue(Path + '/SymetricMap', False);
    17061709    VoidEnabled := GetValue(Path + '/VoidEnabled', True);
    17071710    VoidPercentage := GetValue(Path + '/VoidPercentage', 20);
     
    17311734    RootNode := Doc.DocumentElement;
    17321735    with RootNode do begin
     1736      SymetricMap := ReadBoolean(RootNode, 'SymetricMap', False);
    17331737      VoidEnabled := ReadBoolean(RootNode, 'VoidEnabled', False);
    17341738      VoidPercentage := ReadInteger(RootNode, 'VoidPercentage', 0);
     
    17731777    AppendChild(RootNode);
    17741778    with RootNode do begin
     1779      WriteBoolean(RootNode, 'SymetricMap', SymetricMap);
    17751780      WriteBoolean(RootNode, 'VoidEnabled', VoidEnabled);
    17761781      WriteInteger(RootNode, 'VoidPercentage', VoidPercentage);
     
    19341939procedure TGame.New;
    19351940var
    1936   X, Y: Integer;
    1937   NewCell: TCell;
    19381941  I: Integer;
    19391942  StartCell: TCell;
     
    19561959    Player := nil;
    19571960  end;
     1961
     1962  if SymetricMap then begin
     1963    for C := 0 to Map.Cells.Count div 2 - 1 do begin
     1964      TCell(Map.Cells[C]).Terrain :=
     1965        TCell(Map.Cells[Map.Cells.Count - 1 - C]).Terrain;
     1966      TCell(Map.Cells[C]).Power :=
     1967        TCell(Map.Cells[Map.Cells.Count - 1 - C]).Power;
     1968    end;
     1969  end;
     1970
    19581971  for I := 0 to Players.Count - 1 do
    19591972  with TPlayer(Players[I]) do begin
     
    19691982          raise Exception.Create(SCannotSetPlayerStartCells);
    19701983      end;
     1984      if SymetricMap and (I = 1) then
     1985        StartCell := TCell(Map.Cells[Map.Cells.Count - 1 - Map.Cells.IndexOf(TPlayer(Players[0]).StartCell)]);
     1986
    19711987      StartCell.Terrain := ttCity;
    19721988      StartCell.Player := TPlayer(Players[I]);
  • trunk/xtactics.lpi

    r68 r70  
    134134        <HasResources Value="True"/>
    135135        <ResourceBaseClass Value="Form"/>
     136        <UnitName Value="UFormMove"/>
    136137      </Unit6>
    137138      <Unit7>
     
    141142        <HasResources Value="True"/>
    142143        <ResourceBaseClass Value="Form"/>
     144        <UnitName Value="UFormNew"/>
    143145      </Unit7>
    144146      <Unit8>
Note: See TracChangeset for help on using the changeset viewer.