Changeset 281 for trunk/Forms


Ignore:
Timestamp:
Feb 21, 2019, 10:45:41 PM (6 years ago)
Author:
chronos
Message:
  • Added: New map type hexagonal horizontal.
  • Added: Limit allowed map type according selected game system.
Location:
trunk/Forms
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormNew.lfm

    r279 r281  
    2121    Top = 60
    2222    Width = 806
    23     ActivePage = TabSheetPlayers
     23    ActivePage = TabSheetMap
    2424    Align = alClient
    2525    BorderSpacing.Around = 4
    26     TabIndex = 1
     26    TabIndex = 2
    2727    TabOrder = 0
    2828    OnChange = PageControl1Change
     
    178178      object Panel1: TPanel
    179179        Left = 0
    180         Height = 652
     180        Height = 596
    181181        Top = 0
    182182        Width = 796
    183183        Align = alClient
    184184        BevelOuter = bvNone
    185         ClientHeight = 652
     185        ClientHeight = 596
    186186        ClientWidth = 796
    187187        TabOrder = 0
     
    260260          Height = 38
    261261          Top = 104
    262           Width = 208
     262          Width = 304
    263263          ItemHeight = 0
    264264          Items.Strings = (
     
    277277          Height = 38
    278278          Top = 144
    279           Width = 208
     279          Width = 304
    280280          ItemHeight = 0
    281281          Items.Strings = (
     
    579579          object TabSheetCaptureCells: TTabSheet
    580580            ClientHeight = 74
    581             ClientWidth = 763
     581            ClientWidth = 769
    582582            object Label14: TLabel
    583583              Left = 8
     
    601601          object TabSheetStayAliveTurns: TTabSheet
    602602            ClientHeight = 74
    603             ClientWidth = 763
     603            ClientWidth = 769
    604604            object Label13: TLabel
    605605              Left = 8
     
    701701      Width = 254
    702702      ItemHeight = 0
     703      OnChange = ComboBoxGameSystemChange
    703704      Style = csDropDownList
    704705      TabOrder = 0
  • trunk/Forms/UFormNew.pas

    r279 r281  
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
    99  ComCtrls, Spin, ExtCtrls, ActnList, ExtDlgs, Menus, UGame, UGeometry, UPlayer,
    10   UGameServer, UServerList, UMap, UFormPlayers;
     10  UGameServer, UServerList, UMap, UFormPlayers, UGameSystem;
    1111
    1212type
     
    111111    procedure CheckBoxSymetricMapChange(Sender: TObject);
    112112    procedure CheckBoxVoidChange(Sender: TObject);
     113    procedure ComboBoxGameSystemChange(Sender: TObject);
    113114    procedure ComboBoxGridTypeChange(Sender: TObject);
    114115    procedure ComboBoxMapShapeChange(Sender: TObject);
     
    143144    NewRandSeed: Cardinal;
    144145    FormPlayers: TFormPlayers;
     146    GameSystem: TGameSystem;
    145147    procedure LoadGame(Game: TGame);
    146148    procedure SaveGame(Game: TGame);
     
    165167
    166168uses
    167   UFormPlayer, UFormChat, UCore, UFormServer, UClientGUI, UFormClient,
    168   UFormGameSystems, UGameSystem;
     169  UFormChat, UCore, UFormServer, UClientGUI, UFormClient,
     170  UFormGameSystems, UMapType;
    169171
    170172resourcestring
    171   SGridTypeHexagon = 'Hexagonal';
    172   SGridTypeSquare = 'Square';
    173   SGridTypeTriangle = 'Triangural';
    174   SGridTypeRandom = 'Random';
    175   SGridTypeIsometric = 'Isometric';
    176173  SWinObjectiveNone = 'None';
    177174  SWinObjectiveDefeatAllOponents = 'Defeat all oponents';
     
    296293    RadioGroupGrowAmount.ItemIndex := Integer(GrowAmount);
    297294    RadioGroupGrowCells.ItemIndex := Integer(GrowCells);
    298     ComboBoxGridType.ItemIndex := Integer(MapType) - 1;
     295    ComboBoxGridType.ItemIndex := ComboBoxGridType.Items.IndexOfObject(TObject(MapType));
    299296    ComboBoxWinObjective.ItemIndex := Integer(WinObjective);
    300297    SpinEditNeutralUnits.Value := MaxNeutralUnits;
     
    325322    GrowAmount := TGrowAmount(RadioGroupGrowAmount.ItemIndex);
    326323    GrowCells := TGrowCells(RadioGroupGrowCells.ItemIndex);
    327     MapType := TMapType(ComboBoxGridType.ItemIndex + 1);
     324    MapType := TMapType(ComboBoxGridType.Items.Objects[ComboBoxGridType.ItemIndex]);
    328325    WinObjective := TWinObjective(ComboBoxWinObjective.ItemIndex);
    329326    MaxNeutralUnits := SpinEditNeutralUnits.Value;
     
    406403    LastIndex := ItemIndex;
    407404    Clear;
    408     Items.Add(SGridTypeHexagon);
    409     Items.Add(SGridTypeSquare);
    410     Items.Add(SGridTypeTriangle);
    411     Items.Add(SGridTypeRandom);
    412     Items.Add(SGridTypeIsometric);
     405    Items.AddObject(SGridTypeHexagonVertical, TObject(mtHexagonVertical));
     406    Items.AddObject(SGridTypeHexagonHorizontal, TObject(mtHexagonHorizontal));
     407    Items.AddObject(SGridTypeSquare, TObject(mtSquare));
     408    Items.AddObject(SGridTypeTriangle, TObject(mtTriangle));
     409    Items.AddObject(SGridTypeRandom, TObject(mtRandom));
     410    Items.AddObject(SGridTypeIsometric, TObject(mtIsometric));
    413411    ItemIndex := LastIndex;
    414412  end;
     
    462460  WinObjective: TWinObjective;
    463461begin
     462  GameSystem := TGameSystem(ComboBoxGameSystem.Items.Objects[ComboBoxGameSystem.ItemIndex]);
     463  ComboBoxGridType.Enabled := GameSystem.PreferedMapType = mtNone;
     464  if GameSystem.PreferedMapType <> mtNone then
     465    ComboBoxGridType.ItemIndex := ComboBoxGridType.Items.IndexOfObject(TObject(GameSystem.PreferedMapType));
    464466  EditImageFile.Enabled := ComboBoxMapShape.ItemIndex = Integer(msImage);
    465467  ButtonImageBrowse.Enabled := ComboBoxMapShape.ItemIndex = Integer(msImage);
     
    544546end;
    545547
     548procedure TFormNew.ComboBoxGameSystemChange(Sender: TObject);
     549begin
     550  UpdateInterface;
     551  MapPreviewRedraw;
     552end;
     553
    546554procedure TFormNew.ComboBoxGridTypeChange(Sender: TObject);
    547555begin
Note: See TracChangeset for help on using the changeset viewer.