Changeset 194 for trunk/UGame.pas


Ignore:
Timestamp:
May 14, 2018, 5:38:45 PM (6 years ago)
Author:
chronos
Message:
  • Added: Configurable game parameter maximum units per cell.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UGame.pas

    r193 r194  
    1717  TriangleCellMulY = 1.05;
    1818  MaxPlayerCount = 8;
     19  DefaultMaxPower = 99;
    1920
    2021type
     
    460461    FogOfWar: Boolean;
    461462    BridgeEnabled: Boolean;
     463    MaxPower: Integer;
    462464    function AttackProbability(AttackCount, DefendCount: Integer): Double;
    463465    procedure LoadConfig(Config: TXmlConfig; Path: string);
     
    14061408  DefaultCellSize.X := ReadInteger(Node, 'DefaultCellSizeX', 1);
    14071409  DefaultCellSize.Y := ReadInteger(Node, 'DefaultCellSizeY', 1);
    1408   MaxPower := ReadInteger(Node, 'MaxPower', 99);
     1410  MaxPower := ReadInteger(Node, 'MaxPower', DefaultMaxPower);
    14091411  Shape := TMapShape(ReadInteger(Node, 'Shape', Integer(msRectangle)));
    14101412  Node2 := Node.FindNode('Cells');
     
    16561658constructor TMap.Create;
    16571659begin
    1658   MaxPower := 99;
     1660  MaxPower := DefaultMaxPower;
    16591661  DefaultCellSize := TPoint.Create(220, 220);
    16601662  Cells := TCells.Create;
     
    32603262      VoidPercentage := ReadInteger(RootNode, 'VoidPercentage', 0);
    32613263      MaxNeutralUnits := ReadInteger(RootNode, 'MaxNeutralUnits', 3);
     3264      MaxPower := ReadInteger(RootNode, 'MaxPower', DefaultMaxPower);
    32623265      GrowCells := TGrowCells(ReadInteger(RootNode, 'GrowCells', Integer(gcNone)));
    32633266      GrowAmount := TGrowAmount(ReadInteger(RootNode, 'GrowAmount', Integer(gaByOne)));
     
    33093312      WriteInteger(RootNode, 'VoidPercentage', VoidPercentage);
    33103313      WriteInteger(RootNode, 'MaxNeutralUnits', MaxNeutralUnits);
     3314      WriteInteger(RootNode, 'MaxPower', MaxPower);
    33113315      WriteInteger(RootNode, 'GrowCells', Integer(GrowCells));
    33123316      WriteInteger(RootNode, 'GrowAmount', Integer(GrowAmount));
     
    34473451  VoidEnabled := True;
    34483452  VoidPercentage := 20;
    3449   MaxNeutralUnits := 4;
     3453  MaxPower := DefaultMaxPower;
     3454  MaxNeutralUnits := Min(4, MaxPower);
    34503455
    34513456  Map.Game := Self;
     
    34773482
    34783483  Map.Generate;
     3484  Map.MaxPower := MaxPower;
    34793485  BuildTerrain;
    34803486
Note: See TracChangeset for help on using the changeset viewer.