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.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.