Changeset 72 for trunk


Ignore:
Timestamp:
Sep 28, 2014, 9:21:26 PM (10 years ago)
Author:
chronos
Message:
  • Fixed: Unit move win probability was bad calculated if already existed move was modified.
  • Added: Easier close of unit move dialog by Escape or Enter key.
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.pas

    r71 r72  
    171171    AToolBarBigIcons.Checked := GetValue(Path + '/LargeIcons', False);
    172172    AToolBarVisible.Checked := GetValue(Path + '/ToolBarVisible', True);
    173     AStatusBarVisible.Checked := GetValue(Path + '/StatusBarVisible', True);
     173    AStatusBarVisible.Checked := GetValue(Path + '/StatusBarVisible', False);
    174174  end;
    175175end;
  • trunk/Forms/UFormMove.lfm

    r59 r72  
    99  ClientWidth = 320
    1010  OnCreate = FormCreate
     11  OnKeyPress = FormKeyPress
    1112  OnShow = FormShow
    12   LCLVersion = '1.0.10.0'
     13  LCLVersion = '1.3'
    1314  object SpinEditOnce: TSpinEdit
    1415    Left = 208
    15     Height = 27
     16    Height = 32
    1617    Top = 32
    1718    Width = 98
    1819    OnChange = SpinEditOnceChange
     20    OnKeyPress = FormKeyPress
    1921    TabOrder = 0
    2022  end
    2123  object Label1: TLabel
    2224    Left = 24
    23     Height = 18
     25    Height = 22
    2426    Top = 32
    25     Width = 36
     27    Width = 46
    2628    Caption = 'Once:'
    2729    ParentColor = False
    2830  end
    2931  object ButtonOk: TButton
    30     Left = 184
     32    Left = 189
    3133    Height = 25
    3234    Top = 224
     
    4850  object Label2: TLabel
    4951    Left = 24
    50     Height = 18
     52    Height = 22
    5153    Top = 136
    52     Width = 66
     54    Width = 87
    5355    Caption = 'Every turn:'
    5456    ParentColor = False
     
    5658  object SpinEditRepeat: TSpinEdit
    5759    Left = 208
    58     Height = 27
     60    Height = 32
    5961    Top = 128
    6062    Width = 98
    6163    OnChange = SpinEditRepeatChange
     64    OnKeyPress = FormKeyPress
    6265    TabOrder = 3
    6366  end
     
    7275    TickStyle = tsNone
    7376    Anchors = [akTop, akLeft, akRight]
     77    OnKeyPress = FormKeyPress
    7478    TabOrder = 4
    7579  end
     
    8488    TickStyle = tsNone
    8589    Anchors = [akTop, akLeft, akRight]
     90    OnKeyPress = FormKeyPress
    8691    TabOrder = 5
    8792  end
     
    126131  object Label3: TLabel
    127132    Left = 16
    128     Height = 18
     133    Height = 22
    129134    Top = 8
    130     Width = 96
     135    Width = 127
    131136    Caption = 'Win probability:'
    132137    ParentColor = False
     
    134139  object LabelWinProbability: TLabel
    135140    Left = 232
    136     Height = 18
     141    Height = 22
    137142    Top = 8
    138     Width = 10
     143    Width = 15
    139144    Caption = '   '
    140145    ParentColor = False
  • trunk/Forms/UFormMove.pas

    r63 r72  
    3333    procedure ButtonOnceMinClick(Sender: TObject);
    3434    procedure ButtonRepeatMaxClick(Sender: TObject);
     35    procedure FormKeyPress(Sender: TObject; var Key: char);
    3536    procedure FormShow(Sender: TObject);
    3637    procedure SpinEditOnceChange(Sender: TObject);
     
    8990procedure TFormMove.FormShow(Sender: TObject);
    9091begin
    91   ButtonOk.SetFocus;
     92  SpinEditOnce.SetFocus;
    9293  UpdateView;
    9394end;
     
    118119end;
    119120
     121procedure TFormMove.FormKeyPress(Sender: TObject; var Key: char);
     122begin
     123  if Key = #13 then ButtonOk.Click;
     124  if Key = #27 then ButtonCancel.Click;
     125end;
     126
    120127procedure TFormMove.SpinEditRepeatChange(Sender: TObject);
    121128begin
  • trunk/UCore.pas

    r68 r72  
    8181procedure TCore.DoOnMove(CellFrom, CellTo: TCell; var CountOnce,
    8282  CountRepeat: Integer; Update: Boolean; var Confirm: Boolean);
     83var
     84  I: Integer;
    8385begin
    8486  if Update then FormMove.SpinEditOnce.MaxValue := CellFrom.GetAvialPower + CountOnce
     
    9294  FormMove.TrackBarRepeat.Position := FormMove.SpinEditRepeat.Value;
    9395  FormMove.DefendCount := CellTo.Power;
    94   FormMove.AttackCount := CellTo.GetAttackPower;
     96  // Attack count from other surrounding cells without current move if already exists
     97  FormMove.AttackCount := 0;
     98  for I := 0 to CellTo.MovesTo.Count - 1 do
     99  if TUnitMove(CellTo.MovesTo[I]).CellFrom <> CellFrom then
     100    FormMove.AttackCount := FormMove.AttackCount + TUnitMove(CellTo.MovesTo[I]).CountOnce;
    95101  FormMove.ShowWinProbability := CellTo.Player <> CellFrom.Player;
     102
    96103  if FormMove.ShowModal = mrOk then begin
    97104    CountOnce := FormMove.SpinEditOnce.Value;
  • trunk/UGame.pas

    r71 r72  
    14871487  end else Result := 1;
    14881488  if DefendCount = 0 then Exit;
    1489   if Depth > 5 then Exit;
     1489  // TODO: Limiting depth is not solving problem with probability of high near
     1490  // numbers like 96 vs. 92. Complexity of calculation should be simplified
     1491  // in different way
     1492  if Depth > 10 then Exit;
    14901493
    14911494  OA := Min(AttackCount, 3);
Note: See TracChangeset for help on using the changeset viewer.