Changeset 69 for trunk


Ignore:
Timestamp:
Sep 28, 2014, 5:42:51 PM (10 years ago)
Author:
chronos
Message:
 
Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.lfm

    r62 r69  
    55  Width = 775
    66  Caption = 'xTactics'
    7   ClientHeight = 600
     7  ClientHeight = 595
    88  ClientWidth = 775
    99  Menu = MainMenu1
     
    1313  OnDestroy = FormDestroy
    1414  OnShow = FormShow
    15   LCLVersion = '1.0.10.0'
     15  LCLVersion = '1.3'
    1616  WindowState = wsMaximized
    1717  object PaintBox1: TPaintBox
    1818    Left = 40
    19     Height = 579
     19    Height = 569
    2020    Top = 0
    2121    Width = 735
     
    3232  object StatusBar1: TStatusBar
    3333    Left = 0
    34     Height = 21
    35     Top = 579
     34    Height = 26
     35    Top = 569
    3636    Width = 775
    3737    Panels = <   
     
    4949  object ToolBar1: TToolBar
    5050    Left = 0
    51     Height = 579
     51    Height = 569
    5252    Top = 0
    5353    Width = 40
     
    8787    object ToolButton6: TToolButton
    8888      Left = 1
    89       Top = 194
     89      Top = 172
    9090      Action = AZoomIn
    9191    end
    9292    object ToolButton7: TToolButton
    9393      Left = 1
    94       Top = 226
     94      Top = 204
    9595      Action = AZoomOut
    9696    end
    9797    object ToolButton8: TToolButton
    9898      Left = 1
    99       Top = 258
     99      Top = 236
    100100      Action = AZoomAll
    101101    end
  • trunk/Forms/UFormMain.pas

    r62 r69  
    343343procedure TFormMain.PaintBox1MouseUp(Sender: TObject; Button: TMouseButton;
    344344  Shift: TShiftState; X, Y: Integer);
    345 begin
    346   if (Abs(StartMousePoint.X - X) < 5) and (Abs(StartMousePoint.Y - Y) < 5) then begin
     345const
     346  MouseMinDiff = 10;
     347begin
     348  if (Abs(StartMousePoint.X - X) < MouseMinDiff) and (Abs(StartMousePoint.Y - Y) < MouseMinDiff) then begin
    347349    if Core.Game.Running and (Core.Game.CurrentPlayer.Mode = pmHuman) then begin
    348350      Core.Game.CurrentPlayer.View.SelectCell(Point(X, Y), Core.Game.CurrentPlayer);
  • trunk/UGame.pas

    r68 r69  
    11481148  S: string;
    11491149const
    1150   AttackDiff = 2;
     1150  AttackDiff = 1;
    11511151begin
    11521152  AllCells := Game.Map.Cells;
     
    12831283  NewTargetCells.OwnsObjects := False;
    12841284
    1285   // Get list of all our cells which can attack
     1285  // Get list of all enemy border cells
    12861286  for C := 0 to AllCells.Count - 1 do
    12871287  with TCell(AllCells[C]) do begin
    1288     if (Player = Game.CurrentPlayer) then begin
     1288    if (Player <> Game.CurrentPlayer) and (Player <> nil) and (Terrain <> ttVoid) then begin
    12891289      Cells := Game.Map.GetCellNeighbors(TCell(AllCells[C]));
    12901290      CanAttack := 0;
    12911291      for I := 0 to Length(Cells) - 1 do
    1292       if (Cells[I].Player <> Game.CurrentPlayer) and (Cells[I].Terrain <> ttVoid) then begin
     1292      if ((Cells[I].Player = Game.CurrentPlayer) or (Cells[I].Player = nil)) and (Cells[I].Terrain <> ttVoid) then begin
    12931293        Inc(CanAttack);
    12941294      end;
     
    13101310    for C := 0 to TargetCells.Count - 1 do
    13111311    with TCell(TargetCells[C]) do begin
    1312       //
    13131312      Cells := Game.Map.GetCellNeighbors(TCell(TargetCells[C]));
    1314       for I := 0 to Length(Cells) - 1 do
    1315       if (Cells[I].Player = Game.CurrentPlayer) and (Cells[I].Terrain <> ttVoid)
    1316       and (not Cells[I].Mark) then begin
    1317         Game.SetMove(Cells[I], TCell(TargetCells[C]), Cells[I].GetAvialPower);
    1318         TCell(TargetCells[C]).Mark := True;
    1319         NewTargetCells.Add(Cells[I]);
     1313      for I := 0 to Length(Cells) - 1 do begin
     1314        if (Cells[I].Terrain <> ttVoid) and (not Cells[I].Mark) then begin
     1315          if (TCell(TargetCells[C]).Player = Game.CurrentPlayer) and
     1316          (Cells[I].Player = Game.CurrentPlayer) then begin
     1317            // Do not take units from front line
     1318            Cells2 := Game.Map.GetCellNeighbors(TCell(Cells[I]));
     1319            CanAttack := 0;
     1320            for J := 0 to Length(Cells2) - 1 do
     1321            if ((Cells2[J].Player <> Game.CurrentPlayer) or (Cells2[J].Player = nil))
     1322            and (Cells2[J].Terrain <> ttVoid) then begin
     1323              Inc(CanAttack);
     1324            end;
     1325            if CanAttack = 0 then
     1326              Game.SetMove(Cells[I], TCell(TargetCells[C]), Cells[I].GetAvialPower);
     1327          end;
     1328          TCell(TargetCells[C]).Mark := True;
     1329          NewTargetCells.Add(Cells[I]);
     1330        end;
    13201331      end;
    13211332    end;
     
    16951706    VoidEnabled := GetValue(Path + '/VoidEnabled', True);
    16961707    VoidPercentage := GetValue(Path + '/VoidPercentage', 20);
    1697     Map.Size := Point(GetValue(Path + '/MapSizeX', 15),
    1698       GetValue(Path + '/MapSizeY', 15));
    1699     CityEnabled := GetValue(Path + '/CityEnabled', True);
     1708    Map.Size := Point(GetValue(Path + '/MapSizeX', 10),
     1709      GetValue(Path + '/MapSizeY', 10));
     1710    CityEnabled := GetValue(Path + '/CityEnabled', False);
    17001711    CityPercentage := GetValue(Path + '/CityPercentage', 10);
    17011712    GrowAmount := TGrowAmount(GetValue(Path + '/GrowAmount', Integer(gaBySquareRoot)));
     
    18391850  MoveAll(CurrentPlayer);
    18401851  Map.Grow(CurrentPlayer);
     1852  UpdateRepeatMoves(CurrentPlayer);
    18411853  ComputePlayerStats;
    18421854  PrevPlayer := CurrentPlayer;
     
    18471859  if Players.IndexOf(CurrentPlayer) < Players.IndexOf(PrevPlayer) then Inc(TurnCounter);
    18481860  CheckWinObjective;
    1849   UpdateRepeatMoves(CurrentPlayer);
    18501861  // For computers take view from previous human
    18511862  if CurrentPlayer.Mode = pmComputer then CurrentPlayer.View.Assign(PrevPlayer.View);
Note: See TracChangeset for help on using the changeset viewer.