Changeset 75


Ignore:
Timestamp:
Oct 4, 2014, 11:33:16 PM (10 years ago)
Author:
chronos
Message:
  • Added: New game option "Map shape" which can use image in file as base for map generation. Black color is used as void.
  • Modified: New game dialog restructured to separate player, map and rules settings.
Location:
trunk
Files:
3 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMove.lfm

    r72 r75  
    33  Height = 257
    44  Top = 165
    5   Width = 320
     5  Width = 367
    66  ActiveControl = ButtonOk
    77  Caption = 'Move'
    88  ClientHeight = 257
    9   ClientWidth = 320
     9  ClientWidth = 367
    1010  OnCreate = FormCreate
    1111  OnKeyPress = FormKeyPress
     
    1414  object SpinEditOnce: TSpinEdit
    1515    Left = 208
    16     Height = 32
    17     Top = 32
     16    Height = 35
     17    Top = 40
    1818    Width = 98
    1919    OnChange = SpinEditOnceChange
     
    2222  end
    2323  object Label1: TLabel
    24     Left = 24
    25     Height = 22
    26     Top = 32
    27     Width = 46
     24    Left = 16
     25    Height = 25
     26    Top = 40
     27    Width = 54
    2828    Caption = 'Once:'
    2929    ParentColor = False
     
    5050  object Label2: TLabel
    5151    Left = 24
    52     Height = 22
     52    Height = 25
    5353    Top = 136
    54     Width = 87
     54    Width = 100
    5555    Caption = 'Every turn:'
    5656    ParentColor = False
     
    5858  object SpinEditRepeat: TSpinEdit
    5959    Left = 208
    60     Height = 32
     60    Height = 35
    6161    Top = 128
    6262    Width = 98
     
    6767  object TrackBarOnce: TTrackBar
    6868    Left = 56
    69     Height = 43
    70     Top = 71
    71     Width = 208
     69    Height = 46
     70    Top = 80
     71    Width = 255
    7272    OnChange = TrackBarOnceChange
    7373    PageSize = 1
     
    8080  object TrackBarRepeat: TTrackBar
    8181    Left = 56
    82     Height = 43
     82    Height = 46
    8383    Top = 168
    84     Width = 208
     84    Width = 255
    8585    OnChange = TrackBarRepeatChange
    8686    PageSize = 1
     
    9494    Left = 8
    9595    Height = 25
    96     Top = 80
     96    Top = 88
    9797    Width = 48
    9898    Caption = 'Min'
     
    101101  end
    102102  object ButtonOnceMax: TButton
    103     Left = 264
     103    Left = 311
    104104    Height = 25
    105     Top = 80
     105    Top = 88
    106106    Width = 48
    107107    Anchors = [akTop, akRight]
     
    120120  end
    121121  object ButtonRepeatMax: TButton
    122     Left = 264
     122    Left = 311
    123123    Height = 25
    124124    Top = 176
     
    131131  object Label3: TLabel
    132132    Left = 16
    133     Height = 22
     133    Height = 25
    134134    Top = 8
    135     Width = 127
     135    Width = 145
    136136    Caption = 'Win probability:'
    137137    ParentColor = False
    138138  end
    139139  object LabelWinProbability: TLabel
    140     Left = 232
    141     Height = 22
     140    Left = 264
     141    Height = 25
    142142    Top = 8
    143143    Width = 15
  • trunk/Forms/UFormNew.lfm

    r74 r75  
    11object FormNew: TFormNew
    2   Left = 440
    3   Height = 614
    4   Top = 178
    5   Width = 716
     2  Left = 987
     3  Height = 528
     4  Top = 500
     5  Width = 745
    66  Caption = 'New game'
    7   ClientHeight = 614
    8   ClientWidth = 716
     7  ClientHeight = 528
     8  ClientWidth = 745
    99  OnCreate = FormCreate
    1010  OnDestroy = FormDestroy
    1111  OnShow = FormShow
    1212  LCLVersion = '1.3'
    13   object Panel1: TPanel
    14     Left = 0
    15     Height = 170
    16     Top = 0
    17     Width = 716
    18     Align = alTop
    19     BevelOuter = bvNone
    20     ClientHeight = 170
    21     ClientWidth = 716
    22     TabOrder = 0
    23     object ListView1: TListView
    24       Left = 16
    25       Height = 150
    26       Top = 8
    27       Width = 594
    28       Anchors = [akTop, akLeft, akRight, akBottom]
    29       Columns = <     
    30         item
    31           Caption = 'Name'
    32           Width = 200
    33         end     
    34         item
    35           Caption = 'Type'
    36           Width = 100
    37         end     
    38         item
    39           Caption = 'Color'
    40           Width = 100
    41         end     
    42         item
    43           Caption = 'Start units'
    44           Width = 177
    45         end>
    46       OwnerData = True
    47       ReadOnly = True
    48       RowSelect = True
    49       TabOrder = 0
    50       ViewStyle = vsReport
    51       OnCustomDrawSubItem = ListView1CustomDrawSubItem
    52       OnData = ListView1Data
    53       OnDblClick = ListView1DblClick
    54       OnKeyPress = ListView1KeyPress
    55       OnKeyUp = ListView1KeyUp
    56       OnSelectItem = ListView1SelectItem
    57     end
    58     object ButtonPlayerAdd: TButton
    59       Left = 616
    60       Height = 25
    61       Top = 8
    62       Width = 83
    63       Action = APlayerAdd
    64       Anchors = [akTop, akLeft, akRight]
    65       Caption = 'Add'
    66       TabOrder = 1
    67     end
    68     object ButtonPlayerRemove: TButton
    69       Left = 616
    70       Height = 25
    71       Top = 40
    72       Width = 83
    73       Action = APlayerRemove
    74       Anchors = [akTop, akRight]
    75       Caption = 'Remove'
    76       TabOrder = 2
    77     end
    78     object ButtonPlayerModify: TButton
    79       Left = 616
    80       Height = 25
    81       Top = 72
    82       Width = 83
    83       Action = APlayerModify
    84       Anchors = [akTop, akRight]
    85       Caption = 'Modify'
    86       TabOrder = 3
    87     end
    88   end
    8913  object Splitter1: TSplitter
    9014    Cursor = crVSplit
    9115    Left = 0
    9216    Height = 5
    93     Top = 170
    94     Width = 716
     17    Top = 0
     18    Width = 745
    9519    Align = alTop
    9620    ResizeAnchor = akTop
    9721  end
    98   object Panel2: TPanel
     22  object ButtonCancel: TButton
     23    Left = 522
     24    Height = 25
     25    Top = 486
     26    Width = 75
     27    Anchors = [akBottom]
     28    Caption = 'Cancel'
     29    ModalResult = 2
     30    TabOrder = 1
     31  end
     32  object ButtonOk: TButton
     33    Left = 626
     34    Height = 25
     35    Top = 486
     36    Width = 75
     37    Anchors = [akRight, akBottom]
     38    Caption = 'Ok'
     39    ModalResult = 1
     40    TabOrder = 2
     41  end
     42  object PageControl1: TPageControl
    9943    Left = 0
    100     Height = 439
    101     Top = 175
    102     Width = 716
    103     Align = alClient
    104     BevelOuter = bvNone
    105     ClientHeight = 439
    106     ClientWidth = 716
    107     TabOrder = 2
    108     object ButtonOk: TButton
    109       Left = 624
    110       Height = 25
    111       Top = 392
    112       Width = 75
    113       Anchors = [akRight, akBottom]
    114       Caption = 'Ok'
    115       ModalResult = 1
    116       TabOrder = 0
    117     end
    118     object ButtonCancel: TButton
    119       Left = 535
    120       Height = 25
    121       Top = 392
    122       Width = 75
    123       Anchors = [akBottom]
    124       Caption = 'Cancel'
    125       ModalResult = 2
    126       TabOrder = 1
    127     end
    128     object CheckBoxVoid: TCheckBox
    129       Left = 8
    130       Height = 27
    131       Top = 101
    132       Width = 198
    133       Caption = 'Inaccessible places'
    134       OnChange = CheckBoxVoidChange
    135       TabOrder = 2
    136     end
    137     object Label1: TLabel
    138       Left = 8
    139       Height = 25
    140       Top = 9
    141       Width = 104
    142       Caption = 'Map width:'
    143       ParentColor = False
    144     end
    145     object SpinEditMapSizeX: TSpinEdit
    146       Left = 128
    147       Height = 35
    148       Top = 4
    149       Width = 98
    150       MinValue = 2
    151       OnChange = SpinEditMapSizeXChange
    152       TabOrder = 3
    153       Value = 2
    154     end
    155     object SpinEditMapSizeY: TSpinEdit
    156       Left = 128
    157       Height = 35
    158       Top = 55
    159       Width = 98
    160       MinValue = 2
    161       OnChange = SpinEditMapSizeYChange
    162       TabOrder = 4
    163       Value = 2
    164     end
    165     object SpinEditVoidPercent: TSpinEdit
    166       Left = 216
    167       Height = 35
    168       Top = 97
    169       Width = 106
    170       MinValue = 1
    171       TabOrder = 5
    172       Value = 1
    173     end
    174     object Label3: TLabel
    175       Left = 331
    176       Height = 25
    177       Top = 102
    178       Width = 17
    179       Caption = '%'
    180       ParentColor = False
    181     end
    182     object TrackBarSizeX: TTrackBar
    183       Left = 240
    184       Height = 46
    185       Top = 1
    186       Width = 451
    187       Max = 100
    188       Min = 2
    189       OnChange = TrackBarSizeXChange
    190       Position = 2
    191       TickStyle = tsNone
    192       Anchors = [akTop, akLeft, akRight]
    193       TabOrder = 6
    194     end
    195     object TrackBarSizeY: TTrackBar
    196       Left = 240
    197       Height = 46
    198       Top = 49
    199       Width = 451
    200       Max = 100
    201       Min = 2
    202       OnChange = TrackBarSizeYChange
    203       Position = 2
    204       TickStyle = tsNone
    205       Anchors = [akTop, akLeft, akRight]
    206       TabOrder = 7
    207     end
    208     object Label2: TLabel
    209       Left = 8
    210       Height = 25
    211       Top = 57
    212       Width = 110
    213       Caption = 'Map height:'
    214       ParentColor = False
    215     end
    216     object CheckBoxCity: TCheckBox
    217       Left = 8
    218       Height = 27
    219       Top = 141
    220       Width = 73
    221       Caption = 'Cities'
    222       OnChange = CheckBoxCityChange
    223       TabOrder = 8
    224     end
    225     object SpinEditCityPercent: TSpinEdit
    226       Left = 216
    227       Height = 35
    228       Top = 137
    229       Width = 106
    230       MinValue = 1
    231       TabOrder = 9
    232       Value = 1
    233     end
    234     object Label4: TLabel
    235       Left = 331
    236       Height = 25
    237       Top = 142
    238       Width = 17
    239       Caption = '%'
    240       ParentColor = False
    241     end
    242     object RadioGroupGrowAmount: TRadioGroup
    243       Left = 376
    244       Height = 76
    245       Top = 97
    246       Width = 305
    247       AutoFill = True
    248       Caption = 'Per turn grow amount'
    249       ChildSizing.LeftRightSpacing = 6
    250       ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
    251       ChildSizing.EnlargeVertical = crsHomogenousChildResize
    252       ChildSizing.ShrinkHorizontal = crsScaleChilds
    253       ChildSizing.ShrinkVertical = crsScaleChilds
    254       ChildSizing.Layout = cclLeftToRightThenTopToBottom
    255       ChildSizing.ControlsPerLine = 1
    256       ClientHeight = 49
    257       ClientWidth = 301
    258       Items.Strings = (
    259         'By one'
    260         'By square root'
    261       )
    262       TabOrder = 10
    263     end
    264     object RadioGroupGrowCells: TRadioGroup
    265       Left = 8
    266       Height = 105
    267       Top = 184
    268       Width = 312
    269       AutoFill = True
    270       Caption = 'Growing cells'
    271       ChildSizing.LeftRightSpacing = 6
    272       ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
    273       ChildSizing.EnlargeVertical = crsHomogenousChildResize
    274       ChildSizing.ShrinkHorizontal = crsScaleChilds
    275       ChildSizing.ShrinkVertical = crsScaleChilds
    276       ChildSizing.Layout = cclLeftToRightThenTopToBottom
    277       ChildSizing.ControlsPerLine = 1
    278       ClientHeight = 78
    279       ClientWidth = 308
    280       Items.Strings = (
    281         'None'
    282         'Player cities'
    283         'Player all'
    284       )
    285       TabOrder = 11
    286     end
    287     object ComboBoxGridType: TComboBox
    288       Left = 473
    289       Height = 37
    290       Top = 201
    291       Width = 208
    292       ItemHeight = 0
    293       Items.Strings = (
    294         'Hexagonal'
    295         'Square'
    296         'Triangular'
    297       )
    298       Style = csDropDownList
    299       TabOrder = 12
    300     end
    301     object Label5: TLabel
    302       Left = 336
    303       Height = 25
    304       Top = 201
    305       Width = 90
    306       Caption = 'Grid type:'
    307       ParentColor = False
    308     end
    309     object Label6: TLabel
    310       Left = 8
    311       Height = 25
    312       Top = 313
    313       Width = 129
    314       Caption = 'Win objective:'
    315       ParentColor = False
    316     end
    317     object ComboBoxWinObjective: TComboBox
    318       Left = 232
    319       Height = 37
    320       Top = 305
    321       Width = 328
    322       ItemHeight = 0
    323       Items.Strings = (
    324         'Defeat all oponents'
    325         'Defeat all oponents cities'
    326         'Capture position'
    327         'Stay alive for number of turns'
    328       )
    329       Style = csDropDownList
    330       TabOrder = 13
    331     end
    332     object Label7: TLabel
    333       Left = 8
    334       Height = 25
    335       Top = 348
    336       Width = 245
    337       Caption = 'Max random neutral units:'
    338       ParentColor = False
    339     end
    340     object SpinEditNeutralUnits: TSpinEdit
    341       Left = 384
    342       Height = 35
    343       Top = 344
    344       Width = 98
    345       MaxValue = 99
    346       OnChange = SpinEditMapSizeYChange
    347       TabOrder = 14
    348       Value = 12
    349     end
    350     object CheckBoxSymetricMap: TCheckBox
    351       Left = 334
    352       Height = 27
    353       Top = 238
    354       Width = 151
    355       Caption = 'Symetric map'
    356       TabOrder = 15
     44    Height = 465
     45    Top = 5
     46    Width = 745
     47    ActivePage = TabSheet1
     48    Align = alTop
     49    Anchors = [akTop, akLeft, akRight, akBottom]
     50    TabIndex = 0
     51    TabOrder = 3
     52    object TabSheet1: TTabSheet
     53      Caption = 'Players'
     54      ClientHeight = 422
     55      ClientWidth = 739
     56      object ListView1: TListView
     57        Left = 8
     58        Height = 368
     59        Top = 8
     60        Width = 713
     61        Anchors = [akTop, akLeft, akRight, akBottom]
     62        Columns = <       
     63          item
     64            Caption = 'Name'
     65            Width = 200
     66          end       
     67          item
     68            Caption = 'Type'
     69            Width = 100
     70          end       
     71          item
     72            Caption = 'Color'
     73            Width = 100
     74          end       
     75          item
     76            Caption = 'Start units'
     77            Width = 296
     78          end>
     79        OwnerData = True
     80        PopupMenu = PopupMenu1
     81        ReadOnly = True
     82        RowSelect = True
     83        TabOrder = 0
     84        ViewStyle = vsReport
     85        OnCustomDrawSubItem = ListView1CustomDrawSubItem
     86        OnData = ListView1Data
     87        OnDblClick = ListView1DblClick
     88        OnKeyPress = ListView1KeyPress
     89        OnKeyUp = ListView1KeyUp
     90        OnSelectItem = ListView1SelectItem
     91      end
     92      object ButtonPlayerRemove: TButton
     93        Left = 240
     94        Height = 25
     95        Top = 384
     96        Width = 83
     97        Action = APlayerRemove
     98        Anchors = [akRight, akBottom]
     99        TabOrder = 1
     100      end
     101      object ButtonPlayerAdd: TButton
     102        Left = 32
     103        Height = 25
     104        Top = 384
     105        Width = 83
     106        Action = APlayerAdd
     107        Anchors = [akRight, akBottom]
     108        TabOrder = 2
     109      end
     110      object ButtonPlayerModify: TButton
     111        Left = 136
     112        Height = 25
     113        Top = 384
     114        Width = 83
     115        Action = APlayerModify
     116        Anchors = [akRight, akBottom]
     117        Caption = 'Modify'
     118        TabOrder = 3
     119      end
     120    end
     121    object TabSheet2: TTabSheet
     122      Caption = 'Map'
     123      ClientHeight = 422
     124      ClientWidth = 739
     125      object Label1: TLabel
     126        Left = 8
     127        Height = 25
     128        Top = 9
     129        Width = 104
     130        Caption = 'Map width:'
     131        ParentColor = False
     132      end
     133      object Label2: TLabel
     134        Left = 8
     135        Height = 25
     136        Top = 57
     137        Width = 110
     138        Caption = 'Map height:'
     139        ParentColor = False
     140      end
     141      object SpinEditMapSizeX: TSpinEdit
     142        Left = 128
     143        Height = 35
     144        Top = 4
     145        Width = 98
     146        MinValue = 2
     147        OnChange = SpinEditMapSizeXChange
     148        TabOrder = 0
     149        Value = 2
     150      end
     151      object SpinEditMapSizeY: TSpinEdit
     152        Left = 128
     153        Height = 35
     154        Top = 55
     155        Width = 98
     156        MinValue = 2
     157        OnChange = SpinEditMapSizeYChange
     158        TabOrder = 1
     159        Value = 2
     160      end
     161      object TrackBarSizeX: TTrackBar
     162        Left = 240
     163        Height = 46
     164        Top = 8
     165        Width = 488
     166        Max = 100
     167        Min = 2
     168        OnChange = TrackBarSizeXChange
     169        Position = 2
     170        TickStyle = tsNone
     171        Anchors = [akTop, akLeft, akRight]
     172        TabOrder = 2
     173      end
     174      object TrackBarSizeY: TTrackBar
     175        Left = 240
     176        Height = 46
     177        Top = 49
     178        Width = 488
     179        Max = 100
     180        Min = 2
     181        OnChange = TrackBarSizeYChange
     182        Position = 2
     183        TickStyle = tsNone
     184        Anchors = [akTop, akLeft, akRight]
     185        TabOrder = 3
     186      end
     187      object Label5: TLabel
     188        Left = 8
     189        Height = 25
     190        Top = 104
     191        Width = 90
     192        Caption = 'Grid type:'
     193        ParentColor = False
     194      end
     195      object ComboBoxGridType: TComboBox
     196        Left = 146
     197        Height = 33
     198        Top = 104
     199        Width = 208
     200        ItemHeight = 0
     201        Items.Strings = (
     202          'Hexagonal'
     203          'Square'
     204          'Triangular'
     205        )
     206        Style = csDropDownList
     207        TabOrder = 4
     208      end
     209      object ComboBoxMapShape: TComboBox
     210        Left = 146
     211        Height = 33
     212        Top = 144
     213        Width = 208
     214        ItemHeight = 0
     215        Items.Strings = (
     216          'Hexagonal'
     217          'Square'
     218          'Triangular'
     219        )
     220        OnChange = ComboBoxMapShapeChange
     221        Style = csDropDownList
     222        TabOrder = 5
     223      end
     224      object Label8: TLabel
     225        Left = 8
     226        Height = 25
     227        Top = 144
     228        Width = 107
     229        Caption = 'Map shape:'
     230        ParentColor = False
     231      end
     232      object CheckBoxSymetricMap: TCheckBox
     233        Left = 472
     234        Height = 27
     235        Top = 110
     236        Width = 151
     237        Caption = 'Symetric map'
     238        TabOrder = 6
     239      end
     240      object SpinEditVoidPercent: TSpinEdit
     241        Left = 216
     242        Height = 35
     243        Top = 224
     244        Width = 106
     245        MinValue = 1
     246        TabOrder = 7
     247        Value = 1
     248      end
     249      object CheckBoxVoid: TCheckBox
     250        Left = 8
     251        Height = 27
     252        Top = 232
     253        Width = 198
     254        Caption = 'Inaccessible places'
     255        OnChange = CheckBoxVoidChange
     256        TabOrder = 8
     257      end
     258      object CheckBoxCity: TCheckBox
     259        Left = 8
     260        Height = 27
     261        Top = 272
     262        Width = 73
     263        Caption = 'Cities'
     264        OnChange = CheckBoxCityChange
     265        TabOrder = 9
     266      end
     267      object SpinEditCityPercent: TSpinEdit
     268        Left = 216
     269        Height = 35
     270        Top = 272
     271        Width = 106
     272        MinValue = 1
     273        TabOrder = 10
     274        Value = 1
     275      end
     276      object Label4: TLabel
     277        Left = 331
     278        Height = 25
     279        Top = 272
     280        Width = 17
     281        Caption = '%'
     282        ParentColor = False
     283      end
     284      object Label3: TLabel
     285        Left = 331
     286        Height = 25
     287        Top = 232
     288        Width = 17
     289        Caption = '%'
     290        ParentColor = False
     291      end
     292      object SpinEditNeutralUnits: TSpinEdit
     293        Left = 408
     294        Height = 35
     295        Top = 352
     296        Width = 98
     297        MaxValue = 99
     298        OnChange = SpinEditMapSizeYChange
     299        TabOrder = 11
     300        Value = 12
     301      end
     302      object Label7: TLabel
     303        Left = 8
     304        Height = 25
     305        Top = 352
     306        Width = 245
     307        Caption = 'Max random neutral units:'
     308        ParentColor = False
     309      end
     310      object EditImageFile: TEdit
     311        Left = 144
     312        Height = 35
     313        Top = 184
     314        Width = 472
     315        Anchors = [akTop, akLeft, akRight]
     316        TabOrder = 12
     317      end
     318      object ButtonImageBrowse: TButton
     319        Left = 624
     320        Height = 25
     321        Top = 192
     322        Width = 99
     323        Anchors = [akTop, akRight]
     324        Caption = 'Browse'
     325        OnClick = ButtonImageBrowseClick
     326        TabOrder = 13
     327      end
     328      object Label9: TLabel
     329        Left = 8
     330        Height = 25
     331        Top = 184
     332        Width = 98
     333        Caption = 'Image file:'
     334        ParentColor = False
     335      end
     336    end
     337    object TabSheet3: TTabSheet
     338      Caption = 'Rules'
     339      ClientHeight = 422
     340      ClientWidth = 739
     341      object RadioGroupGrowCells: TRadioGroup
     342        Left = 8
     343        Height = 105
     344        Top = 104
     345        Width = 312
     346        AutoFill = True
     347        Caption = 'Growing cells'
     348        ChildSizing.LeftRightSpacing = 6
     349        ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
     350        ChildSizing.EnlargeVertical = crsHomogenousChildResize
     351        ChildSizing.ShrinkHorizontal = crsScaleChilds
     352        ChildSizing.ShrinkVertical = crsScaleChilds
     353        ChildSizing.Layout = cclLeftToRightThenTopToBottom
     354        ChildSizing.ControlsPerLine = 1
     355        ClientHeight = 78
     356        ClientWidth = 308
     357        Items.Strings = (
     358          'None'
     359          'Player cities'
     360          'Player all'
     361        )
     362        TabOrder = 0
     363      end
     364      object Label6: TLabel
     365        Left = 8
     366        Height = 25
     367        Top = 248
     368        Width = 129
     369        Caption = 'Win objective:'
     370        ParentColor = False
     371      end
     372      object ComboBoxWinObjective: TComboBox
     373        Left = 232
     374        Height = 37
     375        Top = 240
     376        Width = 328
     377        ItemHeight = 0
     378        Items.Strings = (
     379          'Defeat all oponents'
     380          'Defeat all oponents cities'
     381          'Capture position'
     382          'Stay alive for number of turns'
     383        )
     384        Style = csDropDownList
     385        TabOrder = 1
     386      end
     387      object RadioGroupGrowAmount: TRadioGroup
     388        Left = 15
     389        Height = 76
     390        Top = 16
     391        Width = 305
     392        AutoFill = True
     393        Caption = 'Per turn grow amount'
     394        ChildSizing.LeftRightSpacing = 6
     395        ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
     396        ChildSizing.EnlargeVertical = crsHomogenousChildResize
     397        ChildSizing.ShrinkHorizontal = crsScaleChilds
     398        ChildSizing.ShrinkVertical = crsScaleChilds
     399        ChildSizing.Layout = cclLeftToRightThenTopToBottom
     400        ChildSizing.ControlsPerLine = 1
     401        ClientHeight = 49
     402        ClientWidth = 301
     403        Items.Strings = (
     404          'By one'
     405          'By square root'
     406        )
     407        TabOrder = 2
     408      end
    357409    end
    358410  end
    359411  object ActionList1: TActionList
    360412    Images = Core.ImageListSmall
    361     left = 224
    362     top = 64
     413    left = 256
     414    top = 440
    363415    object APlayerModify: TAction
    364416      Caption = 'Modify player'
     
    366418    end
    367419    object APlayerAdd: TAction
    368       Caption = 'Add player'
     420      Caption = 'Add'
    369421      OnExecute = APlayerAddExecute
    370422    end
    371423    object APlayerRemove: TAction
    372       Caption = 'Remove player'
     424      Caption = 'Remove'
    373425      OnExecute = APlayerRemoveExecute
    374426    end
    375427  end
     428  object OpenPictureDialog1: TOpenPictureDialog
     429    left = 616
     430    top = 280
     431  end
     432  object PopupMenu1: TPopupMenu
     433    left = 128
     434    top = 143
     435    object MenuItem1: TMenuItem
     436      Action = APlayerAdd
     437    end
     438    object MenuItem2: TMenuItem
     439      Action = APlayerModify
     440      Default = True
     441    end
     442    object MenuItem3: TMenuItem
     443      Action = APlayerRemove
     444    end
     445  end
    376446end
  • trunk/Forms/UFormNew.lrt

    r70 r75  
    11TFORMNEW.CAPTION=New game
     2TFORMNEW.BUTTONCANCEL.CAPTION=Cancel
     3TFORMNEW.BUTTONOK.CAPTION=Ok
     4TFORMNEW.TABSHEET1.CAPTION=Players
    25TFORMNEW.LISTVIEW1.COLUMNS[0].CAPTION=Name
    36TFORMNEW.LISTVIEW1.COLUMNS[1].CAPTION=Type
    47TFORMNEW.LISTVIEW1.COLUMNS[2].CAPTION=Color
    58TFORMNEW.LISTVIEW1.COLUMNS[3].CAPTION=Start units
    6 TFORMNEW.BUTTONPLAYERADD.CAPTION=Add
    7 TFORMNEW.BUTTONPLAYERREMOVE.CAPTION=Remove
    89TFORMNEW.BUTTONPLAYERMODIFY.CAPTION=Modify
    9 TFORMNEW.BUTTONOK.CAPTION=Ok
    10 TFORMNEW.BUTTONCANCEL.CAPTION=Cancel
     10TFORMNEW.TABSHEET2.CAPTION=Map
     11TFORMNEW.LABEL1.CAPTION=Map width:
     12TFORMNEW.LABEL2.CAPTION=Map height:
     13TFORMNEW.LABEL5.CAPTION=Grid type:
     14TFORMNEW.LABEL8.CAPTION=Map shape:
     15TFORMNEW.CHECKBOXSYMETRICMAP.CAPTION=Symetric map
    1116TFORMNEW.CHECKBOXVOID.CAPTION=Inaccessible places
    12 TFORMNEW.LABEL1.CAPTION=Map width:
    13 TFORMNEW.LABEL3.CAPTION=%
    14 TFORMNEW.LABEL2.CAPTION=Map height:
    1517TFORMNEW.CHECKBOXCITY.CAPTION=Cities
    1618TFORMNEW.LABEL4.CAPTION=%
     19TFORMNEW.LABEL3.CAPTION=%
     20TFORMNEW.LABEL7.CAPTION=Max random neutral units:
     21TFORMNEW.BUTTONIMAGEBROWSE.CAPTION=Browse
     22TFORMNEW.LABEL9.CAPTION=Image file:
     23TFORMNEW.TABSHEET3.CAPTION=Rules
     24TFORMNEW.RADIOGROUPGROWCELLS.CAPTION=Growing cells
     25TFORMNEW.LABEL6.CAPTION=Win objective:
    1726TFORMNEW.RADIOGROUPGROWAMOUNT.CAPTION=Per turn grow amount
    18 TFORMNEW.RADIOGROUPGROWCELLS.CAPTION=Growing cells
    19 TFORMNEW.LABEL5.CAPTION=Grid type:
    20 TFORMNEW.LABEL6.CAPTION=Win objective:
    21 TFORMNEW.LABEL7.CAPTION=Max random neutral units:
    22 TFORMNEW.CHECKBOXSYMETRICMAP.CAPTION=Symetric map
    2327TFORMNEW.APLAYERMODIFY.CAPTION=Modify player
    24 TFORMNEW.APLAYERADD.CAPTION=Add player
    25 TFORMNEW.APLAYERREMOVE.CAPTION=Remove player
     28TFORMNEW.APLAYERADD.CAPTION=Add
     29TFORMNEW.APLAYERREMOVE.CAPTION=Remove
  • trunk/Forms/UFormNew.pas

    r74 r75  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    9   ComCtrls, Spin, ExtCtrls, ActnList, UGame;
     9  ComCtrls, Spin, ExtCtrls, ActnList, ExtDlgs, Menus, UGame;
    1010
    1111type
     
    1818    APlayerModify: TAction;
    1919    ActionList1: TActionList;
     20    ButtonImageBrowse: TButton;
    2021    ButtonCancel: TButton;
    2122    ButtonOk: TButton;
     
    2324    ButtonPlayerModify: TButton;
    2425    ButtonPlayerRemove: TButton;
     26    CheckBoxCity: TCheckBox;
    2527    CheckBoxSymetricMap: TCheckBox;
    26     CheckBoxCity: TCheckBox;
    2728    CheckBoxVoid: TCheckBox;
    2829    ComboBoxGridType: TComboBox;
     30    ComboBoxMapShape: TComboBox;
    2931    ComboBoxWinObjective: TComboBox;
     32    EditImageFile: TEdit;
    3033    Label1: TLabel;
    3134    Label2: TLabel;
     
    3538    Label6: TLabel;
    3639    Label7: TLabel;
     40    Label8: TLabel;
     41    Label9: TLabel;
    3742    ListView1: TListView;
    38     Panel1: TPanel;
    39     Panel2: TPanel;
     43    MenuItem1: TMenuItem;
     44    MenuItem2: TMenuItem;
     45    MenuItem3: TMenuItem;
     46    OpenPictureDialog1: TOpenPictureDialog;
     47    PageControl1: TPageControl;
     48    PopupMenu1: TPopupMenu;
    4049    RadioGroupGrowAmount: TRadioGroup;
    4150    RadioGroupGrowCells: TRadioGroup;
     
    4655    SpinEditVoidPercent: TSpinEdit;
    4756    Splitter1: TSplitter;
     57    TabSheet1: TTabSheet;
     58    TabSheet2: TTabSheet;
     59    TabSheet3: TTabSheet;
    4860    TrackBarSizeX: TTrackBar;
    4961    TrackBarSizeY: TTrackBar;
     
    5163    procedure APlayerModifyExecute(Sender: TObject);
    5264    procedure APlayerRemoveExecute(Sender: TObject);
     65    procedure ButtonImageBrowseClick(Sender: TObject);
    5366    procedure CheckBoxCityChange(Sender: TObject);
    5467    procedure CheckBoxVoidChange(Sender: TObject);
     68    procedure ComboBoxMapShapeChange(Sender: TObject);
    5569    procedure FormCreate(Sender: TObject);
    5670    procedure FormDestroy(Sender: TObject);
     
    103117  SGrowAmountByOne = 'By one';
    104118  SGrowAmountBySquareRoot = 'By square root';
    105 
     119  SRectangular = 'Rectangular';
     120  SFromImageFile = 'From image file';
    106121
    107122{ TFormNew }
     
    185200    ItemIndex := LastIndex;
    186201  end;
     202  with ComboBoxMapShape do begin
     203    LastIndex := ItemIndex;
     204    Clear;
     205    Items.Add(SRectangular);
     206    Items.Add(SFromImageFile);
     207    ItemIndex := LastIndex;
     208  end;
    187209  with RadioGroupGrowCells do begin
    188210    LastIndex := ItemIndex;
     
    209231  ButtonPlayerAdd.Enabled := Players.Count < MaxPlayerCount;
    210232  APlayerModify.Enabled := Assigned(ListView1.Selected);
     233  EditImageFile.Enabled := ComboBoxMapShape.ItemIndex = Integer(msImage);
     234  ButtonImageBrowse.Enabled := ComboBoxMapShape.ItemIndex = Integer(msImage);
    211235  Translate;
    212236end;
     
    242266begin
    243267  SpinEditVoidPercent.Enabled := CheckBoxVoid.Checked;
     268end;
     269
     270procedure TFormNew.ComboBoxMapShapeChange(Sender: TObject);
     271begin
     272  ReloadView;
    244273end;
    245274
     
    260289    Players.Remove(ListView1.Selected.Data);
    261290    ReloadView;
     291  end;
     292end;
     293
     294procedure TFormNew.ButtonImageBrowseClick(Sender: TObject);
     295begin
     296  OpenPictureDialog1.FileName := EditImageFile.Text;
     297  if OpenPictureDialog1.Execute then begin
     298    EditImageFile.Text := OpenPictureDialog1.FileName;
    262299  end;
    263300end;
     
    309346  ComboBoxWinObjective.ItemIndex := Integer(Game.WinObjective);
    310347  SpinEditNeutralUnits.Value := Game.MaxNeutralUnits;
     348  ComboBoxMapShape.ItemIndex := Integer(Game.Map.Shape);
     349  EditImageFile.Text := Game.MapImageFileName;
    311350end;
    312351
     
    334373  Game.WinObjective := TWinObjective(ComboBoxWinObjective.ItemIndex);
    335374  Game.MaxNeutralUnits := SpinEditNeutralUnits.Value;
     375  Game.Map.Shape := TMapShape(ComboBoxMapShape.ItemIndex);
     376  Game.MapImageFileName := EditImageFile.Text;
    336377end;
    337378
  • trunk/Languages/xtactics.cs.po

    r74 r75  
    195195
    196196#: tformnew.aplayeradd.caption
    197 msgid "Add player"
     197#, fuzzy
     198#| msgid "Add player"
     199msgid "Add"
    198200msgstr "Přidat hráče"
    199201
     
    203205
    204206#: tformnew.aplayerremove.caption
    205 msgid "Remove player"
     207#, fuzzy
     208#| msgid "Remove player"
     209msgid "Remove"
    206210msgstr "Odstranit hráče"
    207211
     
    211215msgstr "Zrušit"
    212216
     217#: tformnew.buttonimagebrowse.caption
     218msgctxt "tformnew.buttonimagebrowse.caption"
     219msgid "Browse"
     220msgstr ""
     221
    213222#: tformnew.buttonok.caption
    214223msgctxt "tformnew.buttonok.caption"
     
    216225msgstr "Ok"
    217226
    218 #: tformnew.buttonplayeradd.caption
    219 msgid "Add"
    220 msgstr "Přidat"
    221 
    222227#: tformnew.buttonplayermodify.caption
    223228msgid "Modify"
    224229msgstr "Upravit"
    225 
    226 #: tformnew.buttonplayerremove.caption
    227 msgid "Remove"
    228 msgstr "Odebrat"
    229230
    230231#: tformnew.caption
     
    277278msgstr "Nejvíce náhodných neutrálních jednotek:"
    278279
     280#: tformnew.label8.caption
     281msgid "Map shape:"
     282msgstr ""
     283
     284#: tformnew.label9.caption
     285msgid "Image file:"
     286msgstr ""
     287
    279288#: tformnew.listview1.columns[0].caption
    280289msgid "Name"
     
    300309msgid "Growing cells"
    301310msgstr "Rostoucí buňky:"
     311
     312#: tformnew.tabsheet1.caption
     313msgid "Players"
     314msgstr ""
     315
     316#: tformnew.tabsheet2.caption
     317msgid "Map"
     318msgstr ""
     319
     320#: tformnew.tabsheet3.caption
     321msgid "Rules"
     322msgstr ""
    302323
    303324#: tformplayer.buttoncancel.caption
     
    414435msgstr "tah"
    415436
     437#: uformnew.sfromimagefile
     438msgid "From image file"
     439msgstr ""
     440
    416441#: uformnew.sgridtypehexagon
    417442msgid "Hexagonal"
     
    449474msgid "Player cities"
    450475msgstr "Města hráče"
     476
     477#: uformnew.srectangular
     478msgid "Rectangular"
     479msgstr ""
    451480
    452481#: uformnew.swinobjectivecaptureposition
  • trunk/Languages/xtactics.po

    r74 r75  
    185185
    186186#: tformnew.aplayeradd.caption
    187 msgid "Add player"
     187msgid "Add"
    188188msgstr ""
    189189
     
    193193
    194194#: tformnew.aplayerremove.caption
    195 msgid "Remove player"
     195msgid "Remove"
    196196msgstr ""
    197197
     
    201201msgstr ""
    202202
     203#: tformnew.buttonimagebrowse.caption
     204msgctxt "TFORMNEW.BUTTONIMAGEBROWSE.CAPTION"
     205msgid "Browse"
     206msgstr ""
     207
    203208#: tformnew.buttonok.caption
    204209msgctxt "TFORMNEW.BUTTONOK.CAPTION"
     
    206211msgstr ""
    207212
    208 #: tformnew.buttonplayeradd.caption
    209 msgid "Add"
    210 msgstr ""
    211 
    212213#: tformnew.buttonplayermodify.caption
    213214msgid "Modify"
    214 msgstr ""
    215 
    216 #: tformnew.buttonplayerremove.caption
    217 msgid "Remove"
    218215msgstr ""
    219216
     
    265262msgstr ""
    266263
     264#: tformnew.label8.caption
     265msgid "Map shape:"
     266msgstr ""
     267
     268#: tformnew.label9.caption
     269msgid "Image file:"
     270msgstr ""
     271
    267272#: tformnew.listview1.columns[0].caption
    268273msgid "Name"
     
    287292#: tformnew.radiogroupgrowcells.caption
    288293msgid "Growing cells"
     294msgstr ""
     295
     296#: tformnew.tabsheet1.caption
     297msgid "Players"
     298msgstr ""
     299
     300#: tformnew.tabsheet2.caption
     301msgid "Map"
     302msgstr ""
     303
     304#: tformnew.tabsheet3.caption
     305msgid "Rules"
    289306msgstr ""
    290307
     
    402419msgstr ""
    403420
     421#: uformnew.sfromimagefile
     422msgid "From image file"
     423msgstr ""
     424
    404425#: uformnew.sgridtypehexagon
    405426msgid "Hexagonal"
     
    436457#: uformnew.sgrowplayercities
    437458msgid "Player cities"
     459msgstr ""
     460
     461#: uformnew.srectangular
     462msgid "Rectangular"
    438463msgstr ""
    439464
  • trunk/UGame.pas

    r74 r75  
    77uses
    88  Classes, SysUtils, ExtCtrls, Graphics, Contnrs, XMLConf, XMLRead, XMLWrite,
    9   DOM, Math, FileUtil, UXMLUtils;
     9  DOM, Math, FileUtil, UXMLUtils, Dialogs;
    1010
    1111const
     
    9191  end;
    9292
     93  TMapShape = (msRectangle, msImage);
     94
    9395  { TMap }
    9496
     
    107109    DefaultCellSize: TPoint;
    108110    Cells: TObjectList; // TList<TCell>
     111    Shape: TMapShape;
     112    Image: TImage;
     113    function IsOutsideShape(Coord: TPoint): Boolean; virtual;
    109114    function IsCellsNeighbor(Cell1, Cell2: TCell): Boolean; virtual;
    110115    function IsValidIndex(Index: TPoint): Boolean; virtual;
     
    266271    FOnWin: TWinEvent;
    267272    FRunning: Boolean;
     273    LoadedImageFileName: string;
    268274    procedure Attack(var AttackPower, DefendPower: Integer);
    269275    procedure MoveAll(Player: TPlayer);
     
    277283    Players: TPlayers;
    278284    Map: TMap;
     285    MapImageFileName: string;
    279286    VoidEnabled: Boolean;
    280287    VoidPercentage: Integer;
     
    596603end;
    597604
     605function TMap.IsOutsideShape(Coord: TPoint): Boolean;
     606var
     607  Rect: TRect;
     608  Color: TColor;
     609  Pos: TPoint;
     610begin
     611  case Shape of
     612    msRectangle: Result := False;
     613    msImage: begin
     614      Rect := GetPixelRect;
     615      with Image.Picture.Bitmap do begin
     616        Pos := Point(Trunc(Coord.X / (Rect.Right - Rect.Left) * Width),
     617          Trunc(Coord.Y / (Rect.Bottom - Rect.Top) * Height));
     618        Color := Canvas.Pixels[Pos.X, Pos.Y];
     619      end;
     620      Result := Color <> clWhite;
     621    end;
     622    else Result := False;
     623  end;
     624end;
     625
    598626procedure TMap.DrawArrow(Canvas: TCanvas; View: TView; Pos: TPoint;
    599627  Angle: Double; Text: string);
     
    655683  Size := Source.Size;
    656684  DefaultCellSize := Source.DefaultCellSize;
     685  Shape := Source.Shape;
    657686  //FSize := Source.Size;
    658687
     
    683712  DefaultCellSize.Y := ReadInteger(Node, 'DefaultCellSizeY', 1);
    684713  MaxPower := ReadInteger(Node, 'MaxPower', 99);
     714  Shape := TMapShape(ReadInteger(Node, 'Shape', Integer(msRectangle)));
    685715end;
    686716
     
    694724  WriteInteger(Node, 'DefaultCellSizeY', DefaultCellSize.Y);
    695725  WriteInteger(Node, 'MaxPower', MaxPower);
     726  WriteInteger(Node, 'Shape', Integer(Shape));
    696727  NewNode := Node.OwnerDocument.CreateElement('Cells');
    697728  Node.AppendChild(NewNode);
     
    828859  Cells := TObjectList.create;
    829860  Size := Point(0, 0);
     861  Image := TImage.Create(nil);
    830862end;
    831863
    832864destructor TMap.Destroy;
    833865begin
     866  Image.Free;
    834867  Size := Point(0, 0);
    835868  FreeAndNil(Cells);
     
    16911724  with Config do begin
    16921725    SetValue(Path + '/GridType', Integer(MapType));
     1726    SetValue(Path + '/MapImage', MapImageFileName);
    16931727    SetValue(Path + '/SymetricMap', SymetricMap);
    16941728    SetValue(Path + '/VoidEnabled', VoidEnabled);
     
    16961730    SetValue(Path + '/MapSizeX', Map.Size.X);
    16971731    SetValue(Path + '/MapSizeY', Map.Size.Y);
     1732    SetValue(Path + '/MapShape', Integer(Map.Shape));
    16981733    SetValue(Path + '/CityEnabled', CityEnabled);
    16991734    SetValue(Path + '/CityPercentage', CityPercentage);
     
    17101745  with Config do begin
    17111746    MapType := TMapType(GetValue(Path + '/GridType', Integer(mtHexagon)));
     1747    MapImageFileName := GetValue(Path + '/MapImage', MapImageFileName);
    17121748    SymetricMap := GetValue(Path + '/SymetricMap', False);
    17131749    VoidEnabled := GetValue(Path + '/VoidEnabled', True);
     
    17151751    Map.Size := Point(GetValue(Path + '/MapSizeX', 10),
    17161752      GetValue(Path + '/MapSizeY', 10));
     1753    Map.Shape := TMapShape(GetValue(Path + '/MapShape', 0));
    17171754    CityEnabled := GetValue(Path + '/CityEnabled', False);
    17181755    CityPercentage := GetValue(Path + '/CityPercentage', 10);
     
    19111948  Players := TPlayers.Create;
    19121949
     1950  MapImageFileName := 'Images/Maps/WorldMap.png';
     1951
    19131952  Randomize;
    19141953
     
    19521991  TurnCounter := 1;
    19531992  Moves.Clear;
     1993  if (Map.Shape = msImage) and FileExists(MapImageFileName) and
     1994  (LoadedImageFileName <> MapImageFileName) then begin
     1995    LoadedImageFileName := MapImageFileName;
     1996    Map.Image.Picture.LoadFromFile(MapImageFileName);
     1997  end;
    19541998  AllCells := Map.GetAllCells;
    19551999  for C := 0 to Length(AllCells) - 1 do
    19562000  with AllCells[C] do begin
    1957     if VoidEnabled and (Random < VoidPercentage / 100) then Terrain := ttVoid
     2001    if (VoidEnabled and (Random < VoidPercentage / 100)) or
     2002    (Map.IsOutsideShape(PosPx)) then Terrain := ttVoid
    19582003      else begin
    19592004        if CityEnabled and (Random < CityPercentage / 100) then Terrain := ttCity
     
    19802025      StartCell := nil;
    19812026      Counter := 0;
    1982       while not Assigned(StartCell) or Assigned(StartCell.Player) do begin
     2027      while not Assigned(StartCell) or Assigned(StartCell.Player) or
     2028     (StartCell.Terrain = ttVoid) do begin
    19832029        StartCell := AllCells[Random(Length(AllCells))];
    19842030        Inc(Counter);
  • trunk/xtactics.lpi

    r74 r75  
    135135        <HasResources Value="True"/>
    136136        <ResourceBaseClass Value="Form"/>
     137        <UnitName Value="UFormMove"/>
    137138      </Unit6>
    138139      <Unit7>
Note: See TracChangeset for help on using the changeset viewer.