Changeset 20 for trunk/UCore.pas


Ignore:
Timestamp:
Oct 5, 2019, 2:00:50 PM (5 years ago)
Author:
chronos
Message:
  • Added: Player can undo last move.
  • Modified: Optimized code of TGame.CanMove method.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UCore.pas

    r19 r20  
    1515  TCore = class(TDataModule)
    1616    AAbout: TAction;
     17    AUndo: TAction;
    1718    ASettings: TAction;
    1819    ActionList1: TActionList;
    1920    AExit: TAction;
    20     AGameNew: TAction;
     21    ANew: TAction;
    2122    ApplicationInfo1: TApplicationInfo;
    2223    PersistentForm1: TPersistentForm;
     
    2526    procedure AAboutExecute(Sender: TObject);
    2627    procedure AExitExecute(Sender: TObject);
    27     procedure AGameNewExecute(Sender: TObject);
     28    procedure ANewExecute(Sender: TObject);
    2829    procedure ASettingsExecute(Sender: TObject);
     30    procedure AUndoExecute(Sender: TObject);
    2931    procedure DataModuleCreate(Sender: TObject);
    3032    procedure DataModuleDestroy(Sender: TObject);
     
    3335  public
    3436    Game: TGame;
     37    procedure UpdateInterface;
    3538    procedure LoadConfig;
    3639    procedure SaveConfig;
     
    6871end;
    6972
     73procedure TCore.AUndoExecute(Sender: TObject);
     74begin
     75  Game.Undo;
     76end;
     77
    7078procedure TCore.AAboutExecute(Sender: TObject);
    7179begin
     
    8492end;
    8593
    86 procedure TCore.AGameNewExecute(Sender: TObject);
     94procedure TCore.ANewExecute(Sender: TObject);
    8795begin
    8896  FormNew := TFormNew.Create(nil);
     
    107115begin
    108116  FormMain.Redraw;
     117  UpdateInterface;
     118end;
     119
     120procedure TCore.UpdateInterface;
     121begin
     122  AUndo.Enabled := Game.CanUndo;;
    109123end;
    110124
Note: See TracChangeset for help on using the changeset viewer.